Loading repository data…
Loading repository data…
inacio000 / repository
TaskMaster CMS - Backend API A modern, multi-tenant Content Management System
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A modern, multi-tenant Content Management System API built with Node.js, Fastify, TypeScript, and Drizzle ORM. Each authenticated user can manage their own content while sharing common resources.
tsx watch| Technology | Purpose |
|---|---|
| Node.js | Runtime environment |
| Fastify | High-performance web framework |
| TypeScript | Type safety |
| PostgreSQL | Database (via Neon) |
| Drizzle ORM | Type-safe database queries |
| Zod | Schema validation |
| Clerk | Authentication & user management |
| Cuid2 | Unique ID generation |
npm install
Create a .env file in the root directory:
# Database (Get from Neon.tech or your PostgreSQL provider)
DATABASE_URL="postgresql://user:password@host/database?sslmode=require"
# Clerk Authentication (Get from clerk.com dashboard)
CLERK_PUBLISHABLE_KEY="pk_test_..."
CLERK_SECRET_KEY="sk_test_..."
npx drizzle-kit push
npm run seed
This creates:
npm run dev
Server runs at http://localhost:3333
The server will automatically reload when you make changes to the code.
All authenticated endpoints require these headers from Clerk:
x-clerk-user-id: User's Clerk IDx-user-email: User's emailx-user-name: User's display namex-user-image-url: User's avatar URL| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/posts | Public | List all published posts |
GET | /api/posts/:id | Public | Get single post details |
GET | /api/posts/my-posts | Required | Get user's own posts (all) |
POST | /api/posts | Required | Create new post |
PUT | /api/posts/:id | Required | Update own post |
DELETE | /api/posts/:id | Required | Delete own post |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/categories | Public | List all categories |
GET | /api/categories/:id | Public | Get category details |
POST | /api/categories | Required | Create category |
PUT | /api/categories/:id | Required | Update category |
DELETE | /api/categories/:id | Required | Delete category |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/tags | Public | List all tags |
GET | /api/tags/:id | Public | Get tag details |
POST | /api/tags | Required | Create tag |
PUT | /api/tags/:id | Required | Update tag |
DELETE | /api/tags/:id | Required | Delete tag |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/dashboard/stats | Required | Get user-specific stats |
Response:
{
"totalPosts": 5, // User's total posts
"drafts": 2, // User's draft posts
"totalCategories": 10, // Global count
"totalTags": 15, // Global count
"totalUsers": 25 // Global count
}
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/posts/:postId/comments | Public | List post comments |
POST | /api/posts/:postId/comments | Required | Add comment |
DELETE | /api/comments/:id | Required | Delete comment |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/users | Public | List all users |
GET | /api/users/:id | Public | Get user details |
src/
├── db/
│ ├── index.ts # Database connection
│ ├── schema.ts # Database schema (tables)
│ └── seed.ts # Sample data seeder
├── http/
│ ├── controllers/ # Business logic
│ │ ├── postsController.ts
│ │ ├── categoriesController.ts
│ │ ├── tagsController.ts
│ │ ├── dashboardController.ts
│ │ └── ...
│ ├── middlewares/ # Request interceptors
│ │ ├── authMiddleware.ts # Authentication
│ │ └── roleMiddleware.ts # Authorization (optional)
│ ├── routes/ # API route definitions
│ │ ├── postsRoutes.ts
│ │ ├── categoriesRoutes.ts
│ │ └── ...
│ └── server.ts # Fastify server setup
├── lib/
│ └── env.ts # Environment validation
└── services/ # External services (future)
npm run dev # Start development server with hot-reload
npm run seed # Seed database with sample data
Using Drizzle Kit:
npx drizzle-kit studio # Open Drizzle Studio (database GUI)
npx drizzle-kit push # Push schema changes to database
Currently configured to accept requests from:
http://localhost:5173 (Frontend dev server)Update in src/http/server.ts if needed.