{"id":24838226,"url":"https://github.com/remojs/rickverse-backend","last_synced_at":"2026-04-14T10:33:03.980Z","repository":{"id":185685019,"uuid":"673940512","full_name":"Remojs/Rickverse-Backend","owner":"Remojs","description":"🎱 Backend repository of the rick and morty website","archived":false,"fork":false,"pushed_at":"2026-03-05T21:53:47.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-06T01:24:09.915Z","etag":null,"topics":["api","express","json","node","rickandmortyapi","web"],"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/Remojs.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}},"created_at":"2023-08-02T19:14:27.000Z","updated_at":"2026-03-05T21:53:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"957a6584-54fa-429d-a6b1-112c956b2eed","html_url":"https://github.com/Remojs/Rickverse-Backend","commit_stats":null,"previous_names":["remojs/rickverse-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Remojs/Rickverse-Backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remojs%2FRickverse-Backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remojs%2FRickverse-Backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remojs%2FRickverse-Backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remojs%2FRickverse-Backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Remojs","download_url":"https://codeload.github.com/Remojs/Rickverse-Backend/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remojs%2FRickverse-Backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31793215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","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","express","json","node","rickandmortyapi","web"],"created_at":"2025-01-31T06:09:48.619Z","updated_at":"2026-04-14T10:33:03.974Z","avatar_url":"https://github.com/Remojs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rickverse — Backend\n\nREST API built with Node.js and Express that serves as the backend for the Rickverse application. It proxies character data from the public [Rick and Morty API](https://rickandmortyapi.com/), handles authentication, and manages a per-session favorites list.\n\n---\n\n## Tech Stack\n\n| Technology | Version | Purpose |\n|---|---|---|\n| Node.js | 16+ | Runtime |\n| Express | 4 | HTTP server \u0026 routing |\n| Axios | 1 | Proxy requests to the Rick and Morty API |\n| Morgan | 1 | HTTP request logger |\n| Jest + Supertest | — | Integration testing |\n| Nodemon | 2 | Dev auto-restart |\n\n---\n\n## Project Structure\n\n```\nsrc/\n├── index.js                  # Entry point — starts the server on the configured port\n├── app.js                    # Express app setup: CORS headers, middleware, router mount\n├── routes/\n│   └── index.js              # All route definitions\n├── controllers/\n│   ├── getCharById.js        # Fetches and shapes a single character from the public API\n│   ├── login.js              # Validates credentials against the local user list\n│   └── handleFavorites.js    # In-memory favorites: add and remove\n└── utils/\n    └── users.js              # Registered user list (email + password)\n\ntest/\n└── index.test.js             # Integration tests with Jest + Supertest\n```\n\n---\n\n## Installation \u0026 Setup\n\n**Prerequisites:** Node.js 16+.\n\n```bash\n# 1. Install dependencies\ncd Server\nnpm install\n\n# 2. Start the server (port 3001 by default)\nnpm start\n\n# Development mode with auto-restart\nnpx nodemon src/index.js\n```\n\nThe port can be overridden with the `PORT` environment variable:\n\n```bash\nPORT=4000 npm start\n```\n\n---\n\n## Available Scripts\n\n| Script | Description |\n|---|---|\n| `npm start` | Starts the server with `node` on port 3001 |\n| `npm test` | Runs the integration test suite with Jest |\n\n---\n\n## API Reference\n\nBase path: `/rickandmorty`\n\n---\n\n### GET `/rickandmorty/character/:id`\n\nFetches a character from the Rick and Morty API and returns a shaped object.\n\n**Parameters**\n\n| Name | In | Type | Description |\n|---|---|---|---|\n| `id` | path | number | Rick and Morty character ID |\n\n**Responses**\n\n| Status | Body | Description |\n|---|---|---|\n| 200 | Character object | Character found |\n| 404 | Error message | ID not found in external API |\n| 500 | Error message | Unexpected server / network error |\n\n**Example response (200)**\n\n```json\n{\n  \"id\": \"1\",\n  \"name\": \"Rick Sanchez\",\n  \"species\": \"Human\",\n  \"origin\": { \"name\": \"Earth (C-137)\" },\n  \"gender\": \"Male\",\n  \"image\": \"https://rickandmortyapi.com/api/character/avatar/1.jpeg\",\n  \"status\": \"Alive\",\n  \"location\": { \"name\": \"Citadel of Ricks\" },\n  \"type\": \"\",\n  \"episode\": [\"https://rickandmortyapi.com/api/episode/1\", \"...\"]\n}\n```\n\n---\n\n### GET `/rickandmorty/login`\n\nValidates a user's credentials.\n\n**Query Parameters**\n\n| Name | Type | Description |\n|---|---|---|\n| `email` | string | User email |\n| `password` | string | User password |\n\n**Responses**\n\n| Status | Body | Description |\n|---|---|---|\n| 200 | `{ \"access\": true }` | Credentials are valid |\n| 404 | `{ \"access\": false }` | Credentials not found |\n\n**Example**\n\n```\nGET /rickandmorty/login?email=Thiagozambonini24@gmail.com\u0026password=Thiago123\n```\n\n---\n\n### POST `/rickandmorty/fav`\n\nAdds a character to the in-memory favorites list. Rejects duplicates.\n\n**Request body** (JSON)\n\n```json\n{\n  \"id\": \"1\",\n  \"name\": \"Rick Sanchez\",\n  \"image\": \"https://...\",\n  \"species\": \"Human\",\n  \"gender\": \"Male\",\n  \"status\": \"Alive\",\n  \"origin\": { \"name\": \"Earth (C-137)\" }\n}\n```\n\n**Responses**\n\n| Status | Body | Description |\n|---|---|---|\n| 200 | Array of favorites | Character added, returns full list |\n| 404 | Error message | Character already exists in favorites |\n\n---\n\n### DELETE `/rickandmorty/fav/:id`\n\nRemoves a character from the in-memory favorites list.\n\n**Parameters**\n\n| Name | In | Type | Description |\n|---|---|---|---|\n| `id` | path | string | Character ID to remove |\n\n**Responses**\n\n| Status | Body | Description |\n|---|---|---|\n| 200 | Array of favorites | Character removed, returns updated list |\n\n\u003e **Note:** The favorites list is stored in memory and resets when the server restarts.\n\n---\n\n## Testing\n\nTests are located in `test/index.test.js` and use Jest with Supertest.\n\n```bash\nnpm test\n```\n\nCovered scenarios:\n\n- `GET /rickandmorty/character/:id` — returns 200 with the expected properties for a valid ID; returns 500 for a malformed ID.\n- `GET /rickandmorty/login` — returns `{ access: true }` for valid credentials; returns `{ access: false }` for invalid credentials.\n- `POST /rickandmorty/fav` — returns 200 and the updated favorites array.\n- `DELETE /rickandmorty/fav/:id` — returns 200 and the updated favorites array.\n\n---\n\n## Credentials (demo)\n\n```\nEmail:    Thiagozambonini24@gmail.com\nPassword: Thiago123\n```\n\n---\n\n## Links\n\n- [Rick and Morty API](https://rickandmortyapi.com/)\n- [LinkedIn — Thiago Zambonini](https://www.linkedin.com/in/thiago-zambonini-2a279a239/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremojs%2Frickverse-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremojs%2Frickverse-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremojs%2Frickverse-backend/lists"}