{"id":22735388,"url":"https://github.com/aleydon/nodejs-template","last_synced_at":"2026-04-14T19:32:30.685Z","repository":{"id":264676103,"uuid":"894056933","full_name":"Aleydon/NodeJs-Template","owner":"Aleydon","description":"Node Js template configured with typescript, eslint, prettier, husky (pre-commit) and more...","archived":false,"fork":false,"pushed_at":"2025-07-14T13:08:10.000Z","size":2305,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T13:54:48.806Z","etag":null,"topics":["api","api-rest","eslint","husky","javascript","jest","js","node","node-js","nodejs","prettier","prisma","relative-path","template","test","testing","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Aleydon.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,"zenodo":null}},"created_at":"2024-11-25T17:13:12.000Z","updated_at":"2025-07-14T10:52:44.000Z","dependencies_parsed_at":"2025-01-17T17:22:25.291Z","dependency_job_id":"f091537e-4866-43cb-9f05-b95a3bed22e2","html_url":"https://github.com/Aleydon/NodeJs-Template","commit_stats":null,"previous_names":["aleydon/nodejs-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/Aleydon/NodeJs-Template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aleydon%2FNodeJs-Template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aleydon%2FNodeJs-Template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aleydon%2FNodeJs-Template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aleydon%2FNodeJs-Template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aleydon","download_url":"https://codeload.github.com/Aleydon/NodeJs-Template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aleydon%2FNodeJs-Template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31812968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","api-rest","eslint","husky","javascript","jest","js","node","node-js","nodejs","prettier","prisma","relative-path","template","test","testing","ts","typescript"],"created_at":"2024-12-10T21:09:28.569Z","updated_at":"2026-04-14T19:32:30.680Z","avatar_url":"https://github.com/Aleydon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Express Template\n\nA robust and scalable Node.js template for building RESTful APIs with Express, TypeScript, Prisma, and more.\n\n## Features\n\n- **Clean Architecture:** Organized codebase with clear separation of concerns (Domain, Application, Infrastructure, Presentation).\n- **Express.js:** Fast, unopinionated, minimalist web framework for Node.js.\n- **TypeScript:** Typed superset of JavaScript that compiles to plain JavaScript.\n- **Prisma:** Next-generation ORM for Node.js and TypeScript.\n- **Zod:** TypeScript-first schema validation with static type inference, integrated into Use Cases.\n- **PostgreSQL:** Powerful, open source object-relational database system.\n- **Docker:** Containerization for easy development and deployment.\n- **Swagger:** API documentation and testing.\n- **ESLint \u0026 Prettier:** Code linting and formatting.\n- **Husky \u0026 commitlint:** Git hooks to enforce commit message conventions.\n- **Jest:** Delightful JavaScript Testing Framework, with unit tests for Use Cases.\n- **Multer:** Middleware for handling `multipart/form-data`.\n\n## Technologies\n\n- [Node.js](https://nodejs.org/)\n- [Express](https://expressjs.com/)\n- [TypeScript](https://www.typescriptlang.org/)\n- [Prisma](https://www.prisma.io/)\n- [Zod](https://zod.dev/)\n- [PostgreSQL](https://www.postgresql.org/)\n- [Docker](https://www.docker.com/)\n- [Swagger](https://swagger.io/)\n- [ESLint](https://eslint.org/)\n- [Prettier](https://prettier.io/)\n- [Husky](https://typicode.github.io/husky/)\n- [commitlint](https://commitlint.js.org/)\n- [Jest](https://jestjs.io/)\n- [tsup](https://tsup.egoist.dev/)\n\n## Getting Started\n\n### Prerequisites\n\n- [Node.js](https://nodejs.org/en/) (v18 or higher)\n- [Docker](https://www.docker.com/get-started)\n\n### Installation\n\n1.  **Clone the repository:**\n\n    ```bash\n    git clone https://github.com/Aleydon/NodeJs-Template.git\n    cd NodeJs-Template\n    ```\n\n2.  **Install dependencies:**\n\n    ```bash\n    npm install\n    # or\n    yarn install\n    ```\n\n3.  **Set up environment variables:**\n\n    Create a `.env` file in the root of the project and add the following variables:\n\n    ```bash\n    DATABASE_URL=\"postgresql://docker:docker@localhost:5432/postgres?schema=public\"\n    PORT=3333\n    ```\n\n### Running the Application\n\n1.  **Start the database:**\n\n    ```bash\n    npm run docker:up\n    ```\n\n2.  **Run database migrations:**\n\n    ```bash\n    npx prisma migrate dev\n    ```\n\n3.  **Start the development server:**\n\n    ```bash\n    npm run dev\n    ```\n\nThe application will be available at `http://localhost:3333`.\n\n## API Endpoints\n\nThe API documentation is available at `http://localhost:3333/docs`.\n\nThe available routes are:\n\n- `GET /users`: List all users.\n- `POST /users`: Create a new user.\n- `PUT /users/:id`: Update a user.\n- `DELETE /users/:id`: Delete a user.\n\n## Database\n\nThis template uses Prisma as the ORM and PostgreSQL as the database. The database schema is defined in `prisma/schema.prisma`.\n\nTo create a new migration, run the following command:\n\n```bash\nnpx prisma migrate dev --name \u003cmigration_name\u003e\n```\n\n## Architecture\n\nThis project follows the principles of Clean Architecture, promoting a clear separation of concerns and testability. The main layers are:\n\n- **Domain Layer:** Contains enterprise-wide business rules and entities (e.g., `User` entity).\n- **Application Layer:** Orchestrates the flow of data to and from the Domain Layer. It contains Use Cases (e.g., `CreateUserUseCase`, `UpdateUserUseCase`) that encapsulate application-specific business rules. Input validation using Zod is performed in this layer.\n- **Infrastructure Layer:** Handles external concerns such as database persistence (e.g., `PrismaUserRepository`), external APIs, and web frameworks (e.g., Express routes).\n- **Presentation Layer:** Deals with how the data is presented to the user (e.g., `UserController` handling HTTP requests and responses).\n\n## Testing\n\nThis project uses Jest for testing. Unit tests are primarily focused on the **Application Layer** (Use Cases) to ensure the core business logic is correct and isolated from external concerns. Dependencies are mocked to achieve true unit testing.\n\nTo run the tests, use the following commands:\n\n- `npm test`: Run all tests.\n- `npm run test:watch`: Run all tests in watch mode.\n- `npm run test:coverage`: Run all tests and generate a coverage report.\n\n## Linting and Formatting\n\nThis project uses ESLint and Prettier for code linting and formatting. To run the linter and formatter, use the following commands:\n\n- `npm run lint`: Lint all files.\n- `npm run format`: Format all files.\n\n## Docker\n\nThis project uses Docker for containerization. To manage the Docker containers, use the following commands:\n\n- `npm run docker:up`: Start the Docker containers.\n- `npm run docker:down`: Stop the Docker containers.\n- `npm run docker:restart`: Restart the Docker containers.\n- `npm run docker:ps`: List all running Docker containers.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleydon%2Fnodejs-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleydon%2Fnodejs-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleydon%2Fnodejs-template/lists"}