{"id":21423118,"url":"https://github.com/afsh7n/neststart","last_synced_at":"2025-03-16T20:25:19.631Z","repository":{"id":264184270,"uuid":"892620145","full_name":"afsh7n/nestStart","owner":"afsh7n","description":"🚀 A scalable and modular NestJS starter with 🐳 Docker, 🐘 PostgreSQL, 🐬 MySQL, and 🌍 environment-based configurations for modern app development.","archived":false,"fork":false,"pushed_at":"2024-11-23T01:16:25.000Z","size":222,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T07:11:17.543Z","etag":null,"topics":["api","docker","environment","mysql","nestjs","nginx","nodejs","postgresql","scalable-architecture","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afsh7n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-22T13:09:13.000Z","updated_at":"2025-01-12T18:32:15.000Z","dependencies_parsed_at":"2024-11-22T21:15:28.613Z","dependency_job_id":null,"html_url":"https://github.com/afsh7n/nestStart","commit_stats":null,"previous_names":["afsh7n/neststart"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afsh7n%2FnestStart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afsh7n%2FnestStart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afsh7n%2FnestStart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afsh7n%2FnestStart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afsh7n","download_url":"https://codeload.github.com/afsh7n/nestStart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243926591,"owners_count":20370008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","docker","environment","mysql","nestjs","nginx","nodejs","postgresql","scalable-architecture","typescript"],"created_at":"2024-11-22T21:14:12.987Z","updated_at":"2025-03-16T20:25:19.610Z","avatar_url":"https://github.com/afsh7n.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 NestJS Modular Project Starter (Enhanced with Docker, Swagger, and Configurations)\n\nWelcome to the **NestJS Modular Project Starter**! 🎉 This boilerplate is designed to kickstart your **NestJS** applications with a highly modular architecture, **Docker** support, **Profile-based configuration**, and **Swagger documentation**. It's perfect for developers aiming to build enterprise-grade, scalable, and maintainable applications.\n\n---\n\n## 📂 Project Structure\n\nHere’s an overview of the full project structure:\n\n```plaintext\nproject-root/\n├── docker/                  \n│   ├── nginx/               # Nginx configuration and Dockerfile\n│   ├── mysql/               # MySQL configuration and Dockerfile\n│   ├── postgres/            # PostgreSQL configuration and Dockerfile\n│   └── app/                 # Application-specific Dockerfile\n├── src/                     \n│   ├── modules/             # All feature modules\n│   │   ├── user/            # Example: User module\n│   │   │   ├── controllers/ # Handles HTTP requests\n│   │   │   ├── services/    # Business logic\n│   │   │   ├── repositories/# Database interactions\n│   │   │   ├── entities/    # Database models\n│   │   │   ├── dtos/        # Data Transfer Objects\n│   │   │   ├── interfaces/  # TypeScript interfaces\n│   │   │   └── user.module.ts # Main module file\n│   │   └── auth/            # Example: Authentication module\n│   │       ├── controllers/ # Auth-related routes\n│   │       ├── services/    # Authentication logic\n│   │       ├── strategies/  # Auth strategies (e.g., JWT)\n│   │       ├── guards/      # Route protection\n│   │       └── auth.module.ts\n│   ├── common/              # Shared utilities and functionalities\n│   │   ├── decorators/      # Custom decorators\n│   │   ├── filters/         # Exception filters\n│   │   ├── pipes/           # Validation pipes\n│   │   ├── enums/           # Shared enums (e.g., status codes, Swagger settings)\n│   │   └── utils/           # Helper functions\n│   ├── configs/             # Configuration files\n│   │   ├── database.config.ts # Database configurations\n│   │   ├── app.config.ts    # General app configurations\n│   │   ├── swagger.config.ts # Swagger-specific configurations\n│   │   └── jwt.config.ts    # JWT configurations\n│   ├── core/                # Core functionalities\n│   │   ├── database/        # Database module\n│   │   ├── logger/          # Logging system\n│   │   ├── swagger/         # Swagger setup\n│   │   └── core.module.ts   # Core module\n│   └── main.ts              # Entry point of the application\n├── docker-compose.mysql.yml # Docker Compose for MySQL\n├── docker-compose.postgres.yml # Docker Compose for PostgreSQL\n├── .env                     # Environment variables\n├── .dockerignore            # Docker ignore rules\n├── .gitignore               # Git ignore rules\n├── package.json             # Project dependencies and scripts\n```\n\n---\n\n## ✨ Features\n\n- **Dockerized Development**: Pre-configured with Docker and Docker Compose for easy setup and deployment.\n- **Multiple Databases**: Switch between **MySQL** and **PostgreSQL** seamlessly using environment variables.\n- **Swagger Integration**: Auto-generated API documentation with built-in support for bearer authentication.\n- **Environment-based Configuration**: Centralized configuration management for different environments (development, production, staging).\n- **Reusable Components**: Shared decorators, filters, pipes, and utilities for a streamlined codebase.\n- **Authentication Ready**: JWT-based authentication module with guards and strategies.\n- **Modular Design**: Clean separation of concerns with fully encapsulated modules.\n- **Nginx Integration**: Acts as a reverse proxy, ready for SSL, caching, and load balancing.\n\n---\n\n## 🛠️ Setup and Run the Project\n\n### **1️⃣ Clone the Repository**\n```bash\ngit clone https://github.com/afsh7n/nestStart.git\ncd nestStart\n```\n\n---\n\n### **2️⃣ Install Dependencies**\nIf you plan to run the project locally:\n```bash\nnpm install\n```\n\n---\n\n### **3️⃣ Configure Environment Variables**\nCreate a `.env` file in the project root. Here’s a sample configuration:\n\n```plaintext\n# ========================\n# General Configuration\n# ========================\nPORT=3000                   # Application port\nNODE_ENV=development        # Environment: development, production, or staging\nPREFIX_API=api\n\n# ========================\n# Database Configuration\n# ========================\nDB_TYPE=postgres            # Database type: mysql or postgres\nDB_HOST=postgres            # Database host (service name in Docker)\nDB_PORT=5432                # Database port\nDB_USERNAME=admin           # Database username\nDB_PASSWORD=password        # Database password\nDB_NAME=my_database         # Database name\n\n# ========================\n# Swagger Configuration\n# ========================\nSWAGGER_TITLE=My Awesome API       # Title of the Swagger documentation\nSWAGGER_DESCRIPTION=API Documentation for My Awesome API # Description of the API\nSWAGGER_VERSION=1.0                # API version for Swagger\nSWAGGER_PATH=api/docs              # URL path for Swagger UI\nSWAGGER_BEARER_AUTH=true           # Enable bearer authentication in Swagger\n\n# ========================\n# JWT Configuration\n# ========================\nJWT_SECRET=my_super_secret_key\nJWT_EXPIRES_IN=1h\n```\n\n---\n\n### **4️⃣ Run with Docker**\n\n#### **For MySQL:**\n```bash\ndocker-compose -f docker-compose.mysql.yml up --build\n```\n\n#### **For PostgreSQL:**\n```bash\ndocker-compose -f docker-compose.postgres.yml up --build\n```\n\n---\n\n### **5️⃣ Access the Application**\n\n- **Swagger UI**: [http://localhost/api/docs](http://localhost/api/docs)\n- **App Direct Access**: [http://localhost:3000](http://localhost:3000)\n\n---\n\n### **6️⃣ Run Locally (Without Docker)**\n1. Set up a local database (e.g., MySQL or PostgreSQL) and update `.env` accordingly.\n2. Run the app:\n   ```bash\n   npm run start:dev\n   ```\n\n---\n\n## 🔗 API Endpoints\n\n### **User Module**\n- **GET /users**: Get the list of users (protected route; requires login).\n- **POST /users**: Add a new user (for testing purposes).\n\n### **Auth Module**\n- **POST /auth/register**: Register a new user.\n- **POST /auth/login**: Login with username and password to obtain a JWT.\n\n---\n\n## 📋 Contributing\n\nWe welcome contributions! Feel free to:\n- Submit pull requests 🚀\n- Report bugs 🐞\n- Suggest new features ✨\n\n---\n\n## 🐳 Docker Overview\n\n- **Nginx**: Acts as a reverse proxy for the application.\n- **App Service**: Runs the NestJS application inside a Node.js container.\n- **MySQL/PostgreSQL**: Database services are dynamically set up using `.env`.\n\n---\n\n## 📜 License\n\nThis project is licensed under the [MIT License](LICENSE). You are free to use, modify, and distribute.\n\n---\n\n## 🤩 Final Thoughts\n\nThank you for using this starter template! If you find it useful, please ⭐ the repository and share it with others.  \nHappy coding! 💻✨","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafsh7n%2Fneststart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafsh7n%2Fneststart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafsh7n%2Fneststart/lists"}