Skip to content

Jayant-Gautam/Brainly-Backend

Repository files navigation

SecondBrain Backend API

A RESTful API service built with Express.js and TypeScript to power the SecondBrain content management system.

🛠️ Technology Stack

  • Node.js
  • Express.js
  • TypeScript
  • MongoDB
  • JWT Authentication

🚀 Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/yourusername/SecondBrainBackend.git

# Navigate to project directory
cd SecondBrainBackend

# Install dependencies
npm install

Environment Setup

Create a .env file in the root directory:

PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CORS_ORIGIN=http://localhost:3000

📚 API Endpoints

Authentication

  • POST /api/signin - User login
  • POST /api/signup - Register new user

Content Management

  • GET /api/content - Retrieve all content
  • POST /api/content - Create new content
  • DELETE /api/content/:id - Delete content

Sharing

  • POST /api/share - Generate share link
  • GET /api/share/:hash - Access shared content

🔧 Development

# Run in development mode
npm run dev

# Build project
npm run build

# Start production server
npm start

📁 Project Structure

src/
├── config/          # Configuration files
├── middleware/     # Custom middleware
├── models/         # MongoDB models
├── routes/         # API routes
└── utils/          # Utility functions

🔒 Security Features

  • JWT-based authentication
  • CORS protection
  • Rate limiting
  • Request validation

🚀 Deployment

This project is configured for Vercel deployment. Required configuration:

{
  "version": 2,
  "builds": [
    {
      "src": "src/index.ts",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "src/index.ts"
    }
  ]
}

👥 Contact

jayant10449@gmail.com

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors