{"id":25216244,"url":"https://github.com/mangelsp/template_node_backend_ts","last_synced_at":"2026-04-02T03:09:25.657Z","repository":{"id":276710194,"uuid":"930043605","full_name":"MangelSP/template_node_backend_ts","owner":"MangelSP","description":"It is a template with everything you need to start a node ts backend project.","archived":false,"fork":false,"pushed_at":"2025-02-10T00:54:52.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T09:14:56.569Z","etag":null,"topics":["backend","express","mongodb","mysql","nodejs","swagger","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/MangelSP.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":"2025-02-10T00:48:22.000Z","updated_at":"2025-02-10T00:57:31.000Z","dependencies_parsed_at":"2025-02-10T01:31:27.644Z","dependency_job_id":"af1bb824-9a01-4579-afa7-1613deb686e6","html_url":"https://github.com/MangelSP/template_node_backend_ts","commit_stats":null,"previous_names":["mangelsp/template_node_backend_ts"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MangelSP%2Ftemplate_node_backend_ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MangelSP%2Ftemplate_node_backend_ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MangelSP%2Ftemplate_node_backend_ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MangelSP%2Ftemplate_node_backend_ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MangelSP","download_url":"https://codeload.github.com/MangelSP/template_node_backend_ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312089,"owners_count":20918344,"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":["backend","express","mongodb","mysql","nodejs","swagger","typescript"],"created_at":"2025-02-10T19:17:27.580Z","updated_at":"2025-12-30T20:25:03.191Z","avatar_url":"https://github.com/MangelSP.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Backend Template with TypeScript\n\nThis is a Node.js backend template built with TypeScript, designed to help you quickly bootstrap scalable and maintainable backend applications. It includes features like authentication, role-based access control, logging, caching, and support for multiple databases (MySQL, PostgreSQL, MongoDB).\n\n## Features\n\n- **TypeScript**: Strongly typed code for better maintainability.\n- **Clean Architecture**: Separation of concerns with controllers, services, and repositories.\n- **Authentication**: JWT-based authentication with role and permission management.\n- **Logging**: Integrated logging using Winston.\n- **Caching**: Support for Redis or in-memory caching.\n- **Multiple Databases**: Support for MySQL, PostgreSQL, and MongoDB.\n- **Swagger Documentation**: Auto-generated API documentation.\n- **Error Handling**: Centralized error handling middleware.\n- **Environment Variables**: Configuration via .env file.\n- **Export Utilities**: Export data to PDF, Excel, and TXT formats.\n\n## Getting Started\n\nFollow these steps to set up and run the project locally.\n\n### Prerequisites\n\n- Node.js (v16 or higher)\n- pnpm (v7 or higher)\n- MySQL/PostgreSQL/MongoDB (optional, depending on your database choice)\n\n### Installation\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/your-username/template-node-backend-ts.git\n   cd template-node-backend-ts\n   ```\n\n2. **Install dependencies:**\n\n   ```bash\n   pnpm install\n   ```\n\n3. **Create a .env file** in the root directory and add the required environment variables:\n\n   ```env\n   PORT=3000\n   JWT_SECRET=your_jwt_secret\n   MYSQL_HOST=localhost\n   MYSQL_PORT=3306\n   MYSQL_USER=root\n   MYSQL_PASSWORD=yourpassword\n   MYSQL_DB=template_db\n   ```\n\n4. **Run the project in development mode:**\n\n   ```bash\n   pnpm dev\n   ```\n\n5. **Access the API documentation at:**\n\n   ```\n   http://localhost:3000/api-docs\n   ```\n\n## Project Structure\n\n```\nsrc/\n├── config/                  # Configuration files (DB, logger, cache, etc.)\n├── controllers/             # Controllers (request/response handling)\n├── services/                # Services (business logic)\n├── repositories/            # Repositories (data access layer)\n├── middleware/              # Middleware (authentication, validation, etc.)\n├── models/                  # Data models (interfaces, types)\n├── routes/                  # API routes\n├── utils/                   # Utility functions (helpers, export utilities)\n├── interfaces/              # Global interfaces\n├── types/                   # Global types\n├── app.ts                   # Express app configuration\n└── server.ts                # Server entry point\n```\n\n## API Endpoints\n\n### Authentication\n\n- **POST** `/auth/login`: Authenticate a user and generate a JWT.\n- **GET** `/auth/profile`: Get the profile of the authenticated user.\n\n### Trips\n\n- **GET** `/trips`: Get a list of all trips.\n- **POST** `/trips`: Create a new trip.\n- **GET** `/trips/:id`: Get a trip by ID.\n- **PUT** `/trips/:id`: Update a trip by ID.\n- **DELETE** `/trips/:id`: Delete a trip by ID.\n\n## Environment Variables\n\n| Variable        | Description                        | Default Value |\n|-----------------|------------------------------------|---------------|\n| PORT            | Port on which the server runs      | 3000          |\n| JWT_SECRET      | Secret key for JWT signing         | -             |\n| MYSQL_HOST      | MySQL database host                | localhost     |\n| MYSQL_PORT      | MySQL database port                | 3306          |\n| MYSQL_USER      | MySQL database user                | root          |\n| MYSQL_PASSWORD  | MySQL database password            | -             |\n| MYSQL_DB        | MySQL database name                | template_db   |\n\n## Running the Project\n\n### Development Mode\n\n```bash\npnpm dev\n```\n\n### Production Mode\n\n1. **Build the project:**\n\n   ```bash\n   pnpm build\n   ```\n\n2. **Start the server:**\n\n   ```bash\n   pnpm start\n   ```\n\n## Testing\n\nTo run tests, use the following command:\n\n```bash\npnpm test\n```\n\n## Exporting Data\n\nThe project includes utilities to export data to PDF, Excel, and TXT formats. Use the following endpoints:\n\n- **POST** `/export/pdf`: Export data to PDF.\n- **POST** `/export/excel`: Export data to Excel.\n- **POST** `/export/txt`: Export data to TXT.\n\n## Contributing\n\n5. Open a pull request.\n\n\n## Acknowledgments\n\n- **Express** - Fast, unopinionated, minimalist web framework for Node.js.\n- **TypeScript** - JavaScript with syntax for types.\n- **Swagger** - API documentation tool.\n- **Winston** - Logging library for Node.js.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmangelsp%2Ftemplate_node_backend_ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmangelsp%2Ftemplate_node_backend_ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmangelsp%2Ftemplate_node_backend_ts/lists"}