Skip to content

tribertmuto/Bookmark_Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔖 Bookmark Manager API

TypeScript MongoDB Express.js JWT Node.js

A modern, secure, and scalable RESTful API for managing bookmarks. Built with TypeScript, Express.js, MongoDB (Mongoose), and JWT authentication.

🌟 Features

  • 🔐 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

🏗️ Project Structure

``` 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 ```

🚀 Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (local or Atlas URI)
  • npm or yarn

Installation

  1. Clone the repository ```bash git clone https://github.com/tribertmuto/Bookmark_Manager.git cd Bookmark_Manager ```

  2. Install dependencies ```bash npm install ```

  3. 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 ```

  4. Start MongoDB

    • Local MongoDB: Start your MongoDB service
    • Atlas: Use your connection string in MONGO_URI
  5. Run the application

    • Development mode: ```bash npm run dev ```
    • Production build: ```bash npm run build npm start ```

📡 API Endpoints

Authentication

Register a new user

```http POST /api/auth/register Content-Type: application/json

{ "name": "John Doe", "email": "john@example.com", "password": "securepassword123" } ```

Login

```http POST /api/auth/login Content-Type: application/json

{ "email": "john@example.com", "password": "securepassword123" }

Response: { "token": "your_jwt_token_here" } ```

Bookmarks (Protected Routes)

All bookmark endpoints require the JWT token in the Authorization header: ```http Authorization: Bearer your_jwt_token_here ```

Get all bookmarks

```http GET /api/bookmarks ```

Create a bookmark

```http POST /api/bookmarks Content-Type: application/json

{ "title": "GitHub", "url": "https://github.com", "description": "Where the world builds software" } ```

Update a bookmark

```http PUT /api/bookmarks/:id Content-Type: application/json

{ "title": "Updated Title", "description": "Updated description" } ```

Delete a bookmark

```http DELETE /api/bookmarks/:id ```

🧪 Testing

Coming soon:

  • Unit tests with Jest
  • Integration tests with Supertest
  • API documentation with Swagger/OpenAPI

📈 Future Enhancements

  • Add tags/categories for bookmarks
  • Implement bookmark sharing
  • Add search functionality
  • Create API documentation with Swagger
  • Add rate limiting
  • Implement refresh tokens

📄 License

MIT License - feel free to use this project for your own learning or as a starting point for your applications.

👥 Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

Built with ❤️ using TypeScript, Express, MongoDB, and JWT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors