A modern, secure, and scalable RESTful API for managing bookmarks. Built with TypeScript, Express.js, MongoDB (Mongoose), and JWT authentication.
-
🔐 Secure Authentication
- JWT-based authentication
- Password hashing with bcrypt
- Protected routes
-
📚 Bookmark Management
- Create, read, update, delete (CRUD) operations
- User-specific bookmarks
- Optional descriptions for better organization
-
🛠️ Technical Stack
- TypeScript for type safety
- MongoDB with Mongoose ODM
- Express.js for routing
- JWT for stateless authentication
``` src/ ├── config/ # Configuration (DB, env variables) ├── controllers/ # Request handlers ├── middlewares/ # Auth & error handling ├── models/ # Mongoose schemas ├── routes/ # API routes ├── services/ # Business logic ├── utils/ # Helper functions ├── tests/ # Test suites ├── app.ts # Express app setup └── server.ts # Entry point ```
- Node.js (v16 or higher)
- MongoDB (local or Atlas URI)
- npm or yarn
-
Clone the repository ```bash git clone https://github.com/tribertmuto/Bookmark_Manager.git cd Bookmark_Manager ```
-
Install dependencies ```bash npm install ```
-
Environment Setup Create a `.env` file in the root directory: ```env PORT=4000 MONGO_URI=mongodb://localhost:27017/bookmarks JWT_SECRET=your_jwt_secret_here ```
-
Start MongoDB
- Local MongoDB: Start your MongoDB service
- Atlas: Use your connection string in MONGO_URI
-
Run the application
- Development mode: ```bash npm run dev ```
- Production build: ```bash npm run build npm start ```
```http POST /api/auth/register Content-Type: application/json
{ "name": "John Doe", "email": "john@example.com", "password": "securepassword123" } ```
```http POST /api/auth/login Content-Type: application/json
{ "email": "john@example.com", "password": "securepassword123" }
Response: { "token": "your_jwt_token_here" } ```
All bookmark endpoints require the JWT token in the Authorization header: ```http Authorization: Bearer your_jwt_token_here ```
```http GET /api/bookmarks ```
```http POST /api/bookmarks Content-Type: application/json
{ "title": "GitHub", "url": "https://github.com", "description": "Where the world builds software" } ```
```http PUT /api/bookmarks/:id Content-Type: application/json
{ "title": "Updated Title", "description": "Updated description" } ```
```http DELETE /api/bookmarks/:id ```
Coming soon:
- Unit tests with Jest
- Integration tests with Supertest
- API documentation with Swagger/OpenAPI
- Add tags/categories for bookmarks
- Implement bookmark sharing
- Add search functionality
- Create API documentation with Swagger
- Add rate limiting
- Implement refresh tokens
MIT License - feel free to use this project for your own learning or as a starting point for your applications.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
Built with ❤️ using TypeScript, Express, MongoDB, and JWT