Conduit RealWorld Backend
A RealWorld / Conduit backend implementation built with TypeScript, Express, and Prisma (PostgreSQL).
Features
- Authentication & Users: JWT-based authentication, user registration, login, get current user, update user settings.
- Profiles: View user profiles, follow and unfollow users.
- Articles: CRUD operations for articles, pagination (limit/offset), tag/author/favorite filters, feed from followed authors, favorite/unfavorite articles.
- Comments: Add, view, and delete comments on articles.
- Tags: List all unique tags.
API Endpoints
Authentication & Users
POST /api/users— Register a new userPOST /api/users/login— Log in an existing userGET /api/user— Get current user profile (requires auth)PUT /api/user— Update current user profile (requires auth)
Profiles
GET /api/profiles/:username— Get profile by usernamePOST /api/profiles/:username/follow— Follow user (requires auth)DELETE /api/profiles/:username/follow— Unfollow user (requires auth)
Articles
GET /api/articles— List articles (filters: tag, author, favorited, limit, offset)GET /api/articles/feed— Feed of articles from followed users (requires auth)GET /api/articles/:slug— Get article by slugPOST /api/articles— Create article (requires auth)PUT /api/articles/:slug— Update article (requires auth, author only)DELETE /api/articles/:slug— Delete article (requires auth, author only)POST /api/articles/:slug/favorite— Favorite article (requires auth)DELETE /api/articles/:slug/favorite— Unfavorite article (requires auth)
Comments
GET /api/articles/:slug/comments— Get comments for articlePOST /api/articles/:slug/comments— Add comment to article (requires auth)DELETE /api/articles/:slug/comments/:id— Delete comment (requires auth, author only)
Tags
GET /api/tags— Get list of all tags
Getting Started
- Copy
.env.exampleto.envand setDATABASE_URLandJWT_SECRET. - Run Prisma migration:
npm run prisma:migrate - Generate Prisma client:
npm run prisma:generate - Start development server:
npm run dev - Run tests:
npm test