{"id":20675909,"url":"https://github.com/olha-dev-fullstack/nest-rest-graphql-events-api","last_synced_at":"2025-03-10T18:43:33.283Z","repository":{"id":258265989,"uuid":"872313604","full_name":"olha-dev-fullstack/nest-rest-graphql-events-api","owner":"olha-dev-fullstack","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-18T10:20:11.000Z","size":353,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-19T10:48:59.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/olha-dev-fullstack.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-10-14T08:16:27.000Z","updated_at":"2024-10-18T10:20:14.000Z","dependencies_parsed_at":"2024-10-22T11:11:32.865Z","dependency_job_id":null,"html_url":"https://github.com/olha-dev-fullstack/nest-rest-graphql-events-api","commit_stats":null,"previous_names":["olha-dev-fullstack/nest-rest-graphql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olha-dev-fullstack%2Fnest-rest-graphql-events-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olha-dev-fullstack%2Fnest-rest-graphql-events-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olha-dev-fullstack%2Fnest-rest-graphql-events-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olha-dev-fullstack%2Fnest-rest-graphql-events-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olha-dev-fullstack","download_url":"https://codeload.github.com/olha-dev-fullstack/nest-rest-graphql-events-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242905028,"owners_count":20204560,"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":[],"created_at":"2024-11-16T21:11:05.915Z","updated_at":"2025-03-10T18:43:33.275Z","avatar_url":"https://github.com/olha-dev-fullstack.png","language":"TypeScript","readme":"# Events API\r\n\r\nThis is a REST + GraphQL event management API where users can authenticate, create events and mark attendance. The project is built using NestJS, Postgres, JWT, and Passport.js for authentication and authorization.\r\n\r\n## Features\r\n\r\n- **Event Management**: Users can create, update, view details and delete events.\r\n- **Attendance**: Users can mark attendance for events, view list of attendeess.\r\n- **Authorization**: JWT authentication is used to secure the API, with Passport.js handling the authorization.\r\n- **REST and GraphQL API**: The application supports both REST and GraphQL (only for user creation) endpoints.\r\n\r\n## Technologies\r\n\r\n- **NestJS**: A progressive Node.js framework for building efficient and scalable server-side applications.\r\n- **PostgreSQL**: A powerful, open-source relational database.\r\n- **JWT (JSON Web Token)**: Used for securing the API endpoints.\r\n- **Passport.js**: A popular middleware for authentication in Node.js.\r\n- **TypeORM**: An ORM used for database interaction and migrations.\r\n- **Docker**: Used for launching database for local development.\r\n- **Jest**: Testing framework used for writing unit and integration tests.\r\n\r\n## How to run the project\r\n\r\n### 1. Clone the Repository\r\n\r\n```bash\r\ngit clone https://github.com/olha-dev-fullstack/nest-rest-graphql-events-api.git\r\ncd events-api\r\n```\r\n\r\n### 2. Install Dependencies\r\n\r\n```bash\r\nnpm install\r\n```\r\n\r\n### 3. Database Setup\r\n\r\nStart Docker and run docker container:\r\n\r\n```bash\r\ndocker-compose up -d\r\n```\r\n\r\n### 5. Start the Server\r\n\r\nRun the NestJS server:\r\n\r\n- watch mode\r\n\r\n```bash\r\nnpm run start:dev\r\n```\r\n\r\n- dev mode\r\n\r\n```bash\r\nnpm run start\r\n```\r\n\r\n- production mode\r\n\r\n```bash\r\nnpm run start:prod\r\n```\r\n\r\n\\*Please note that for production it is needed to create `prod.env` file into `src` folder with all configurations as in `dev.env`\r\n\r\nThe API will be available at `http://localhost:3000`.\r\n\r\n## API Endpoints\r\n\r\n### REST Endpoints\r\n\r\n#### Authentication and Users\r\n\r\n- **POST** `/auth/login`: User login (JWT Token generation)\r\n\r\n```json\r\n{\r\n  \"username\": \"test\",\r\n  \"password\": \"password\"\r\n}\r\n```\r\n\r\n- **GET** `/auth/profile`: Get authorized user profile (requires authentication)\r\n- **POST** `/user`: Register new user\r\n\r\n```json\r\n{\r\n  \"username\": \"test\",\r\n  \"password\": \"password\",\r\n  \"retypedPassword\": \"password\",\r\n  \"firstName\": \"John\",\r\n  \"lastName\": \"Smith\",\r\n  \"email\": \"john@gmail.com\"\r\n}\r\n```\r\n\r\n#### Events\r\n\r\n- **POST** `/events`: Create a new event (requires authentication)\r\n\r\n```json\r\n{\r\n  \"name\": \"Interesting Party\",\r\n  \"description\": \"That is a crazy event, must go there!\",\r\n  \"address\": \"Local St 101\",\r\n  \"when\": \"2021-04-15 21:00:00\"\r\n}\r\n```\r\n\r\n- **GET** `/events`: Get a list of all events\r\n- **GET** `/events/:id`: Get single event\r\n- **DELETE** `/events/:id`: Delete an event (requires authentication)\r\n- **GET** `/events-organized-by-user:id`: Get a list events organized by specific user (requires authentication)\r\n- **PATCH** `/events/:id`: Update an event (requires authentication)\r\n\r\n#### Event Attendance\r\n\r\n- **PUT** `/events-attendance/:id`: Mark attendance for an event (requires authentication)\r\n\r\n```json\r\n{\r\n  \"answer\": 1\r\n}\r\n```\r\n\r\n- **GET** `/events/:id/attendees` Get List of attendees of specific event\r\n- **GET** `/events-attendance/:id` Get specific event attendance by current user\r\n- **GET** `/events-attendance` Get al events to be attended by currenct user\r\n\r\n### GraphQL Endpoints\r\n\r\n- Access GraphQL playground at `/graphql`.\r\n\r\n\\*There is Postman collection with all endpoints included in this repo\r\n\r\n## Authentication and Authorization\r\n\r\n- JWT is used for user authentication.\r\n- You need to pass a valid token in the `Authorization` header for authenticated routes.\r\n\r\nExample:\r\n\r\n```bash\r\nAuthorization: Bearer \u003ctoken\u003e\r\n```\r\n\r\n## Running Tests\r\n\r\nTo run unit tests, use:\r\n\r\n```bash\r\nnpm run test\r\n```\r\n\r\nTo run End-to-End tests, use:\r\n\r\n```bash\r\nnpm run test:e2e\r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folha-dev-fullstack%2Fnest-rest-graphql-events-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folha-dev-fullstack%2Fnest-rest-graphql-events-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folha-dev-fullstack%2Fnest-rest-graphql-events-api/lists"}