{"id":17274295,"url":"https://github.com/arifszn/velvet","last_synced_at":"2025-04-14T08:52:36.805Z","repository":{"id":247525094,"uuid":"821704923","full_name":"arifszn/velvet","owner":"arifszn","description":"🥢 The simplest way to create REST API with Node.js, Express.js, and TypeORM.","archived":false,"fork":false,"pushed_at":"2025-03-24T05:29:24.000Z","size":675,"stargazers_count":6,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T22:23:09.247Z","etag":null,"topics":["backend-api","boilerplate","boilerplate-template","nodejs","nodejs-boilerplate","nodejs-server","starter","starter-kit","starter-project","starter-template","starterkit"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arifszn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"patreon":"arifszn","custom":"buymeacoffee.com/arifszn"}},"created_at":"2024-06-29T07:45:10.000Z","updated_at":"2025-02-07T20:59:33.000Z","dependencies_parsed_at":"2024-07-09T07:44:44.806Z","dependency_job_id":"8089fa6d-8ef0-49ef-a8e6-2d85c66aaab5","html_url":"https://github.com/arifszn/velvet","commit_stats":null,"previous_names":["arifszn/velvet"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifszn%2Fvelvet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifszn%2Fvelvet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifszn%2Fvelvet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifszn%2Fvelvet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arifszn","download_url":"https://codeload.github.com/arifszn/velvet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852078,"owners_count":21171838,"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-api","boilerplate","boilerplate-template","nodejs","nodejs-boilerplate","nodejs-server","starter","starter-kit","starter-project","starter-template","starterkit"],"created_at":"2024-10-15T08:53:35.344Z","updated_at":"2025-04-14T08:52:36.783Z","avatar_url":"https://github.com/arifszn.png","language":"TypeScript","funding_links":["https://patreon.com/arifszn","buymeacoffee.com/arifszn"],"categories":[],"sub_categories":[],"readme":"\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/arifszn/velvet/assets/45073703/4a1fcde5-d62f-40cd-8fba-bbf8a7d21902\" width=\"35%\"\u003e\n\n  \u003ch4 align=\"center\"\u003e📦 REST API Starter Kit/Boilerplate powered by Node.js, Express.js, and TypeORM.\u003c/h4\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/arifszn/velvet/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://github.com/arifszn/velvet/actions/workflows/test.yml/badge.svg\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/arifszn/velvet/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/arifszn/velvet\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/arifszn/velvet/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/arifszn/velvet\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/arifszn/velvet/blob/main/CONTRIBUTING.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/arifszn/velvet/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/arifszn/velvet\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://twitter.com/intent/tweet?url=https://github.com/arifszn/velvet\u0026hashtags=node,opensource,express,typescript,api\"\u003e\u003cimg src=\"https://img.shields.io/twitter/url?style=social\u0026url=https%3A%2F%2Fgithub.com%2Farifszn%2Fvelvet\"/\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/arifszn/velvet/main/src/api-docs.json\"\u003eAPI Docs\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/arifszn/velvet/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/arifszn/velvet/discussions\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n**Velvet** is a modern, customized, minimal API starter kit with CLI to kickstart your next REST API backend. This project provides a robust foundation for building modern, scalable, and maintainable web applications using Node.js, Express, TypeScript, and various other tools and libraries.\n\n## Features\n\n- **Dockerized Environment:** Easily set up and manage your development environment using Docker.\n- **CLI for Resource Generation:** Quickly generate resource files (controller, service, repository, DTO, entity, and route) using the CLI tool.\n- **Service Repository Pattern:** Maintain a clean and modular codebase with a well-structured service repository pattern.\n- **Authentication and Authorization:** Secure your API with JWT-based authentication and role-based access control.\n- **Zod Validation:** Ensure data integrity with schema-based validation using Zod.\n- **Class Transformer DTOs:** Clean and transform your data with Class Transformer.\n- **Swagger UI and Redoc UI:** Generate and visualize your API documentation.\n- **ESLint and Prettier:** Enforce coding standards and ensure a consistent code style.\n- **Winston Logging:** Centralized and customizable logging using Winston.\n- **Advanced searching:** Searching capabilities with sorting, filtering, and keyword search.\n- **GitHub Actions:** CI/CD workflows for testing and linting.\n\n\u003cimg alt=\"CLI Preview\" src=\"https://github.com/user-attachments/assets/8e33dc07-2859-47ad-a59c-ab776e191df4\" width=\"70%\"\u003e\n\n## Getting Started\n\n### Installation\n\n### Copy the environment file\n\n```bash\ncp .env.example .env\n```\n\n### Build and run the Docker containers\n\n```bash\ndocker compose up\n```\n\nThis will start the application along with any other services defined in the docker-compose.yml file.\n\n### Access the application\n\nThe application should now be running at [`http://localhost:3000`](http://localhost:3000) (or the port specified in your docker-compose.yml).\n\n### Running Migrations\n\nTo run the migrations, you can use the following commands inside the Docker container:\n\n#### Generate Migration\n\n```bash\nnpm run migration:generate --name=CreateUsers\n```\n\nReplace _`CreateUsers`_ with name of the migration.\n\n#### Run Migration\n\n```bash\nnpm run migration:run\n```\n\n#### Revert Migration\n\n```bash\nnpm run migration:revert\n```\n\n## Generating Resources\n\nOne of the key features of this starter kit is the ability to quickly generate new resources (e.g., controllers, services, repositories, DTOs, entities, and routes) using the CLI tool.\n\n### Generate a new resource\n\n- Run the generate command:\n\n  ```bash\n  npm run generate\n  ```\n\n- Follow the prompts to enter the resource name and select the file types to generate.\n\n### Example\n\nTo generate a new resource called `Article`, run the command and follow the prompts:\n\n```bash\n  npm run generate\n```\n\n- Enter the resource name: `Article`\n- Select the files to generate: `entity`, `repository`, `service`, `controller`, `route`, `dto`\n\nThis will generate the following files:\n\n- `src/entities/article.entity.ts`\n- `src/repositories/article.repository.ts`\n- `src/services/article.service.ts`\n- `src/controllers/article.controller.ts`\n- `src/routes/articles.ts`\n- `src/dtos/article.dto.ts`\n\nThe generated files will be pre-configured and ready for use, allowing you to focus on implementing your business logic.\n\nRemember to create a migration for the new entity and add the route to the index route (src/routes/index.ts).\n\n## API Documentation\n\nThis starter kit comes with integrated API documentation tools. You can access the Swagger UI and Redoc UI for your API documentation.\n\n- Swagger UI: [`http://localhost:3000/swagger`](http://localhost:3000/swagger)\n- Redoc UI: [`http://localhost:3000/redoc`](http://localhost:3000/redoc)\n\nYou can also access the online API documentation [here](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/arifszn/velvet/main/src/api-docs.json).\n\n## Folder Structure\n\nThe project follows a modular folder structure:\n\n```css\nsrc/\n  ├── configs/           # Application configurations\n  ├── constants/         # Application constants\n  ├── controllers/       # Route controllers\n  ├── dtos/              # Data Transfer Objects\n  ├── entities/          # TypeORM entities\n  ├── exceptions/        # Custom exceptions\n  ├── interfaces/        # TypeScript interfaces\n  ├── middlewares/       # App middlewares\n  ├── migrations/        # Database migrations\n  ├── repositories/      # Data access layer\n  ├── routes/            # API routes\n  ├── services/          # Business logic layer\n  ├── utils/             # Utility functions\n  ├── app.ts             # Application setup\n.env                     # Environment variables\ndocker-compose.yml       # Docker Compose configuration\nDockerfile               # Docker configuration\ntsconfig.json            # TypeScript configuration\n.eslintrc.js             # ESLint configuration\n.prettierrc              # Prettier configuration\n```\n\n## Admin Routes\n\nTo access the admin routes, the authenticated user's `isAdmin` column must be set to `true` in the database. You can update the `isAdmin` field using Adminer, a database management tool accessible at [`http://localhost:8080`](http://localhost:8080).\n\n## Support\n\n\u003cp\u003eYou can show your support by starring this project.\u003c/p\u003e\n\u003ca href=\"https://github.com/arifszn/velvet/stargazers\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/stars/arifszn/velvet?style=social\" alt=\"Github Star\"\u003e\n\u003c/a\u003e\n\n## Contribute\n\nTo contribute, see the [contributing guide](https://github.com/arifszn/velvet/blob/main/CONTRIBUTING.md).\n\n## License\n\n[MIT License](https://github.com/arifszn/velvet/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farifszn%2Fvelvet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farifszn%2Fvelvet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farifszn%2Fvelvet/lists"}