Conduit Backend
A RealWorld (Conduit) backend built with TypeScript, Express, and Prisma (PostgreSQL).
Setup
npm install
npx prisma migrate dev --name init
npm run dev
Configure .env:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/conduit?schema=public"
JWT_SECRET="super-secret-jwt-key-change-me"
JWT_EXPIRES_IN="7d"
PORT=3000
Scripts
npm run dev— start dev server with reloadnpm run build— compile TypeScriptnpm start— run compiled servernpm test— run Jest testsnpm run prisma:migrate— run migrations
Endpoints
Authentication
POST /api/users— registerPOST /api/users/login— log inGET /api/user— current userPUT /api/user— update current user
Profiles
GET /api/profiles/:usernamePOST /api/profiles/:username/followDELETE /api/profiles/:username/follow
Articles
GET /api/articles— list (filters: tag, author, favorited, limit, offset)GET /api/articles/feedGET /api/articles/:slugPOST /api/articlesPUT /api/articles/:slugDELETE /api/articles/:slugPOST /api/articles/:slug/favoriteDELETE /api/articles/:slug/favorite
Comments
GET /api/articles/:slug/commentsPOST /api/articles/:slug/commentsDELETE /api/articles/:slug/comments/:id
Tags
GET /api/tags
Authenticate with the Authorization: Token <jwt> header.