{"id":15714498,"url":"https://github.com/yassersaidi/ex-server","last_synced_at":"2026-02-12T14:03:51.338Z","repository":{"id":254775864,"uuid":"846659623","full_name":"yassersaidi/ex-server","owner":"yassersaidi","description":"repository to offer a practical example and starting point for those diving into backend development with Nodejs and Express","archived":false,"fork":false,"pushed_at":"2024-08-26T10:20:18.000Z","size":158,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-15T15:46:10.367Z","etag":null,"topics":["docker","expressjs","formidable","jest","nodejs","postgresql","prisma-orm","resend","typescript"],"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/yassersaidi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-08-23T17:16:10.000Z","updated_at":"2024-10-18T16:24:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"0542e3c4-2a0c-4775-907d-1ca3729d5f48","html_url":"https://github.com/yassersaidi/ex-server","commit_stats":null,"previous_names":["yassersaidi/ex-server"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/yassersaidi/ex-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassersaidi%2Fex-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassersaidi%2Fex-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassersaidi%2Fex-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassersaidi%2Fex-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yassersaidi","download_url":"https://codeload.github.com/yassersaidi/ex-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yassersaidi%2Fex-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29367850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"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":["docker","expressjs","formidable","jest","nodejs","postgresql","prisma-orm","resend","typescript"],"created_at":"2024-10-03T21:37:41.641Z","updated_at":"2026-02-12T14:03:51.324Z","avatar_url":"https://github.com/yassersaidi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ex-Server 🚀\n\nEx-Server is a Node.js and TypeScript server application using Express.js, PostgreSQL with Prisma as an ORM, and Jest for testing. The server includes features such as user authentication, input validation, email verification, and rate limiting.\n\n## Table of Contents 📚\n\n- [Installation](#installation)\n- [Setup](#setup)\n- [Usage](#usage)\n- [Testing](#testing)\n- [Docker](#docker)\n\n## Installation 🛠️\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/yassersaidi/ex-server.git\n   cd ex-server\n   ```\n\n2. Install dependencies:\n\n```bash\nCopy code\nnpm install\n```\n## Setup ⚙️\n 1. Create a .env file in the root directory of the project and add the required environment variables:(check [.env.example](https://github.com/yassersaidi/ex-server/blob/main/.env.example))\n    \n\n2. Set up your PostgreSQL database and run Prisma migrations:\n\n```bash\nnpx prisma migrate dev\n```\n3. Generate Prisma client:\n```bash\nnpx prisma generate\n```\n## Usage 🚀\nStart the development server:\n```bash\nnpm run dev\n```\nThe server will be running at http://localhost:3001.\n\n## Available Routes 📍\n\n### Authentication Routes 🔐\n\n| Method | Endpoint             | Request Body                                                                                              | Response                                                      |\n|--------|----------------------|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|\n| POST   | /auth/login          | `{ \"email\": \"user@example.com\", \"password\": \"password123\" }`                                           | `{ \"accessToken\": \"token\", \"user\": { \"id\": \"userId\", \"email\": \"user@example.com\", \"username\": \"username\" } }` |\n| POST   | /auth/register       | `{ \"email\": \"user@example.com\", \"username\": \"username\", \"password\": \"password123\" }`                   | `{ \"userId\": \"newUserId\" }`                                  |\n| POST   | /auth/verify-email   | `{ \"email\": \"user@example.com\" }`                                                                       | `{ \"message\": \"Verification code sent!\" }`                   |\n| POST   | /auth/verify-code    | `{ \"email\": \"user@example.com\", \"code\": \"123456\" }`                                                     | `{ \"message\": \"User successfully verified\" }`                |\n| POST   | /auth/forgot-password| `{ \"email\": \"user@example.com\" }`                                                                       | `{ \"message\": \"Password reset code sent!\" }`                 |\n| POST   | /auth/reset-password | `{ \"email\": \"user@example.com\", \"code\": \"123456\", \"password\": \"newPassword123\" }`                      | `{ \"message\": \"Password successfully reset\" }`              |\n| POST   | /auth/rt             | (No request body; token is retrieved from cookies)                                                       | `{ \"accessToken\": \"newAccessToken\" }`                        |\n| POST   | /auth/logout         | (No request body; token is retrieved from cookies)                                                       | `{ \"message\": \"Logged out successfully.\" }`                 |\n\n\n### User Routes 👤\n\n| Method | Endpoint            | Request Body                                                                                   | Response                                                        |\n|--------|---------------------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------|\n| GET    | /user/all           | `{ \"userId\": \"userId\" }`                                                                       | `[ { \"id\": \"userId\", \"email\": \"user@example.com\", \"username\": \"username\", \"createdAt\": \"2024-01-01T00:00:00Z\", \"verified\": true, \"profilePicture\": \"url\" }, ... ]` |\n| GET    | /user/me            | `{ \"userId\": \"userId\" }`                                                                       | `{ \"id\": \"userId\", \"email\": \"user@example.com\", \"username\": \"username\", \"createdAt\": \"2024-01-01T00:00:00Z\", \"verified\": true, \"profilePicture\": \"url\" }` |\n| GET    | /user/get/:username | `{ \"userId\": \"userId\" }`                                                                       | `{ \"id\": \"userId\", \"email\": \"user@example.com\", \"username\": \"username\", \"createdAt\": \"2024-01-01T00:00:00Z\", \"verified\": true, \"profilePicture\": \"url\" }` |\n| PUT    | /user/username      | `{ \"userId\": \"userId\", \"username\": \"newUsername\" }`                                          | `{ \"id\": \"userId\", \"email\": \"user@example.com\", \"username\": \"newUsername\", \"createdAt\": \"2024-01-01T00:00:00Z\", \"verified\": true, \"profilePicture\": \"url\" }` |\n| PUT    | /user/update-image  | `{ \"userId\": \"userId\" }` (Image uploaded via form-data)                                        | `{ \"message\": \"Image updated successfully\", \"updatedUser\": { \"id\": \"userId\", \"email\": \"user@example.com\", \"username\": \"username\", \"createdAt\": \"2024-01-01T00:00:00Z\", \"verified\": true, \"profilePicture\": \"url\" } }` |\n| GET    | /user/search        | `{ \"query\": \"searchTerm\" }`                                                                    | `[ { \"id\": \"userId\", \"email\": \"user@example.com\", \"username\": \"username\", \"createdAt\": \"2024-01-01T00:00:00Z\", \"profilePicture\": \"url\", \"verified\": true }, ... ]` |\n| DELETE | /user/              | `{ \"userId\": \"userId\" }`                                                                       | `{ \"count\": 1 }`                                                |\n### Notes 📓\n- **Request Body**: For endpoints without a request body (like `/auth/rt` and `/auth/logout`), the table indicates that the token is retrieved from cookies.\n- **Response**: Includes possible messages or data returned for each endpoint. Ensure that these match your actual API responses.\n- **Error Handling**: Error responses are generalized. Customize them based on the specifics of your application and its error handling.\n\n## Testing 🧪 \nTo run tests, use the following command:\n```bash\nnpm run test\n```\n\n## Docker 🐳\nTo set up and run your application with Docker, just run this commande:\n```bash\ndocker-compose up --build\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyassersaidi%2Fex-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyassersaidi%2Fex-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyassersaidi%2Fex-server/lists"}