A full-featured Trello clone backend built with Node.js, Express, and MongoDB. This RESTful API provides comprehensive board management, real-time collaboration, and user authentication.
-
🔐 Authentication & Authorization
- JWT-based authentication
- User registration with email verification
- Secure password handling
- Protected routes with middleware
-
📊 Board Management
- Create, read, update, delete boards
- Board ownership and permissions
- Invite users to boards
- Real-time board updates via WebSocket
-
📝 Column & Card System
- Flexible column management
- Drag-and-drop card organization
- Card descriptions and activities
- Card attachments
-
👥 User Collaboration
- User invitations system
- Board member management
- Real-time notifications
-
📁 File Management
- Image upload support (Cloudinary)
- Avatar management
- Card attachments
-
✉️ Email Services
- Email verification
- Invitation emails
- Powered by Brevo
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- Validation: Express Validator / Joi
- File Upload: Multer
- Cloud Storage: Cloudinary
- Email Service: Brevo (formerly Sendinblue)
- WebSocket: Socket.io
- CORS: Express CORS middleware
trello-api/
├── src/
│ ├── config/ # Configuration files
│ │ ├── cors.js
│ │ ├── environment.js
│ │ └── mongodb.js
│ ├── controllers/ # Request handlers
│ │ ├── boardController.js
│ │ ├── cardController.js
│ │ ├── columnController.js
│ │ ├── invitationController.js
│ │ └── userController.js
│ ├── middlewares/ # Custom middleware
│ │ ├── authMiddleware.js
│ │ ├── erorHandlingMiddleware.js
│ │ └── multerUploadMiddleware.js
│ ├── models/ # Database models
│ │ ├── boardModel.js
│ │ ├── cardModel.js
│ │ ├── columnModel.js
│ │ ├── invitationModel.js
│ │ └── userModel.js
│ ├── providers/ # Third-party service integrations
│ │ ├── BrevoProvider.js
│ │ ├── CloudinaryProvider.js
│ │ └── JwtProvider.js
│ ├── routes/ # API routes
│ │ └── v1/
│ │ ├── boardRoute.js
│ │ ├── cardRoute.js
│ │ ├── columnRoute.js
│ │ ├── invitationRoute.js
│ │ ├── userRoute.js
│ │ └── index.js
│ ├── services/ # Business logic
│ │ ├── boardService.js
│ │ ├── cardService.js
│ │ ├── columnService.js
│ │ ├── invitationService.js
│ │ └── userService.js
│ ├── sockets/ # WebSocket handlers
│ │ └── inviteUserToBoardSocket.js
│ ├── utils/ # Utility functions
│ │ ├── algorithms.js
│ │ ├── ApiError.js
│ │ ├── constants.js
│ │ ├── formatters.js
│ │ ├── sorts.js
│ │ └── validators.js
│ ├── validations/ # Request validation schemas
│ │ ├── boardValidation.js
│ │ ├── cardValidation.js
│ │ ├── columnValidation.js
│ │ ├── invitationValidation.js
│ │ └── userValidation.js
│ └── server.js # Application entry point
├── .env.example
├── .eslintrc.cjs
├── .babelrc
├── jsconfig.json
└── package.json
- Node.js (v16 or higher)
- MongoDB (v4.4 or higher)
- npm or yarn
-
Clone the repository
git clone https://github.com/Justinianus2001/trello-api.git cd trello-api -
Install dependencies
npm install
-
Set up environment variables
Copy
.env.exampleto.envand fill in your credentials:cp .env.example .env
Required environment variables:
# Server Configuration LOCAL_DEV_APP_HOST=localhost LOCAL_DEV_APP_PORT=8017 # Build Mode BUILD_MODE=dev # Database MONGODB_URI=your_mongodb_connection_string DATABASE_NAME=your_database_name # JWT Secret JWT_SECRET=your_jwt_secret_key # Cloudinary (for file uploads) CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret # Brevo (for emails) BREVO_API_KEY=your_brevo_api_key BREVO_SENDER_EMAIL=your_sender_email BREVO_SENDER_NAME=Your_App_Name # Client URL (for CORS and email links) CLIENT_URL=http://localhost:5173
-
Start the development server
npm run dev
The API will be available at
http://localhost:8017
npm run build
npm starthttp://localhost:8017/v1
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /users/register |
Register a new user | No |
| POST | /users/login |
Login user | No |
| GET | /users/verify/:token |
Verify email | No |
| GET | /users/me |
Get current user | Yes |
| PUT | /users/update |
Update user profile | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /boards |
Get all user boards | Yes |
| POST | /boards |
Create new board | Yes |
| GET | /boards/:id |
Get board details | Yes |
| PUT | /boards/:id |
Update board | Yes |
| DELETE | /boards/:id |
Delete board | Yes |
| POST | /boards/:id/invite |
Invite user to board | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /columns |
Create column | Yes |
| PUT | /columns/:id |
Update column | Yes |
| DELETE | /columns/:id |
Delete column | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /cards |
Create card | Yes |
| PUT | /cards/:id |
Update card | Yes |
| DELETE | /cards/:id |
Delete card | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /invitations |
Get user invitations | Yes |
| POST | /invitations/:id/accept |
Accept invitation | Yes |
| POST | /invitations/:id/decline |
Decline invitation | Yes |
This API uses JWT (JSON Web Tokens) for authentication. Include the token in the Authorization header:
Authorization: Bearer <your_jwt_token>
npm testThis project uses ESLint for code linting. Run the linter:
npm run lint- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Hoang Le Ngoc - @Justinianus2001
- Inspired by Trello
- Built as a learning project for full-stack development
For questions or support, please open an issue or contact: lengochoang681@gmail.com
Frontend Repository: trello-web