• Home

  • Projects

  • Home
  • Projects
Listyo Adi Pamungkas - 2025 - All rights reserved
SitemapRSS Feed

    nerack-backend

    nerack-backend

    Created at 9/4/2025 β€’ 3 min read
    Repository
    Tags: Share:

    Nerack Backend API

    Personal Bookshelf Management System - Backend API built with NestJS

    #Features

    • Authentication & Authorization: JWT-based authentication with bcrypt password hashing
    • Clean Architecture: Modular structure with feature-based organization
    • API Documentation: Swagger/OpenAPI documentation
    • Type Safety: Full TypeScript implementation
    • Testing: Jest testing framework with unit and e2e tests
    • Validation: Request/response validation with class-validator
    • Configuration: Environment-based configuration management

    #Quick Start

    ##Prerequisites

    • Node.js 18+ and npm
    • PostgreSQL database

    ##Installation

    # Install dependencies
    npm install
    
    # Copy environment variables
    cp .env.example .env
    
    # Configure your database connection in .env
    # DATABASE_URL="postgresql://username:password@localhost:5432/nerack_db"
    
    # Start development server
    npm run start:dev
    

    ##API Documentation

    Once the server is running, visit:
    • Swagger UI: http://localhost:3000/api/docs
    • API JSON: http://localhost:3000/api/docs-json

    #Available Scripts

    # Development
    npm run start:dev      # Start with file watching
    npm run start:debug    # Start in debug mode
    
    # Production
    npm run build          # Build the application
    npm run start:prod     # Start production server
    
    # Testing
    npm run test           # Run unit tests
    npm run test:watch     # Run tests in watch mode
    npm run test:cov       # Run tests with coverage
    npm run test:e2e       # Run end-to-end tests
    
    # Code Quality
    npm run lint           # Run ESLint
    npm run format         # Format code with Prettier
    

    #Project Structure

    src/ β”œβ”€β”€ main.ts # Application entry point β”œβ”€β”€ app.module.ts # Root application module β”œβ”€β”€ modules/ β”‚ β”œβ”€β”€ auth/ # Authentication module β”‚ β”‚ β”œβ”€β”€ auth.controller.ts β”‚ β”‚ β”œβ”€β”€ auth.service.ts β”‚ β”‚ └── auth.module.ts β”‚ β”œβ”€β”€ users/ # Users module β”‚ β”‚ β”œβ”€β”€ users.controller.ts β”‚ β”‚ β”œβ”€β”€ users.service.ts β”‚ β”‚ └── users.module.ts β”‚ └── books/ # Books module (coming soon) β”œβ”€β”€ common/ # Shared utilities β”‚ β”œβ”€β”€ guards/ # Authentication guards β”‚ β”œβ”€β”€ decorators/ # Custom decorators β”‚ β”œβ”€β”€ filters/ # Exception filters β”‚ └── pipes/ # Validation pipes └── config/ # Configuration modules └── database.config.ts

    #API Endpoints

    ##Authentication

    • POST /api/auth/register - User registration
    • POST /api/auth/login - User login

    ##Users

    • GET /api/users/profile - Get user profile
    • PUT /api/users/profile - Update user profile

    ##Books (Coming Soon)

    • GET /api/books - List user's books
    • POST /api/books - Add new book
    • PUT /api/books/:id - Update book
    • DELETE /api/books/:id - Delete book

    #Environment Variables

    VariableDescriptionDefault
    NODE_ENVEnvironment modedevelopment
    PORTServer port3000
    DATABASE_URLPostgreSQL connection stringRequired
    JWT_SECRETJWT secret keyRequired
    JWT_EXPIRATIONJWT token expiration24h

    #Contributing

    1. Follow the existing code style and architecture
    2. Write tests for new features
    3. Update documentation as needed
    4. Ensure all tests pass before submitting

    #License

    MIT License - see LICENSE file for details.
    Previous

    nerack

    Next

    nerubot