{"id":21047430,"url":"https://github.com/gabrielalmir/smartparking-api","last_synced_at":"2026-05-02T17:36:32.992Z","repository":{"id":236849660,"uuid":"793276371","full_name":"gabrielalmir/smartparking-api","owner":"gabrielalmir","description":"Sensor Management API: A Fastify-based RESTful API for managing sensor data, integrating Prisma for database operations and Zod for schema validation","archived":false,"fork":false,"pushed_at":"2024-06-23T13:42:40.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T17:50:58.591Z","etag":null,"topics":["fastify","nodejs","prisma","smartparking","zod"],"latest_commit_sha":null,"homepage":"https://smartparking-api.vercel.app","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/gabrielalmir.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-04-28T22:24:34.000Z","updated_at":"2024-06-23T13:42:43.000Z","dependencies_parsed_at":"2024-05-20T23:45:23.510Z","dependency_job_id":"b62c4f3f-dc50-4792-979f-acfcb03c45f5","html_url":"https://github.com/gabrielalmir/smartparking-api","commit_stats":null,"previous_names":["gabrielalmir/smartparking-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielalmir%2Fsmartparking-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielalmir%2Fsmartparking-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielalmir%2Fsmartparking-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielalmir%2Fsmartparking-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrielalmir","download_url":"https://codeload.github.com/gabrielalmir/smartparking-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243491470,"owners_count":20299309,"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":["fastify","nodejs","prisma","smartparking","zod"],"created_at":"2024-11-19T14:37:03.261Z","updated_at":"2025-10-26T10:23:36.220Z","avatar_url":"https://github.com/gabrielalmir.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sensor Management API\n\nThis project provides a RESTful API for managing sensor data using Fastify, a web framework for Node.js. It integrates with Prisma for database operations and Zod for schema validation. The API supports CRUD operations for sensors, including fetching all sensors, retrieving a specific sensor by ID, creating a new sensor, and updating an existing sensor's status.\n\n## Features\n\n- **CRUD Operations**: Full support for Create, Read, Update, and Delete (CRUD) operations on sensor data.\n- **Validation**: Utilizes Zod for input validation to ensure data integrity.\n- **Database Integration**: Uses Prisma to interact with the database, providing a type-safe API for database operations.\n- **Cross-Origin Resource Sharing (CORS)**: Enabled via Fastify's CORS plugin to allow cross-origin requests.\n\n## Setup\n\n1. **Install Dependencies**: Run `npm install` to install all required dependencies.\n2. **Environment Configuration**: Ensure `.env` file is configured with the correct `PORT`.\n3. **Database Setup**: Initialize and configure your database connection in `./config/db.js`.\n4. **Run the Server**: Execute `node index.js` to start the server.\n\n## Endpoints\n\n### GET /sensors\n\n- **Description**: Fetches all sensor records.\n- **Response**: An array of sensor objects.\n\n### GET /sensors/:sensor\n\n- **Description**: Retrieves a specific sensor by its ID.\n- **Parameters**: `sensor` - The unique identifier of the sensor.\n- **Response**: A single sensor object or a 404 error if not found.\n\n### POST /sensors\n\n- **Description**: Creates a new sensor record.\n- **Body**: A JSON object containing `name`, `sensor`, `status`, `latitude`, and `longitude`.\n- **Response**: The newly created sensor object or a 409 error if the sensor already exists.\n\n### PUT /sensors/:sensor\n\n- **Description**: Updates the status of a specific sensor.\n- **Parameters**: `sensor` - The unique identifier of the sensor.\n- **Body**: A JSON object containing the new `status`.\n- **Response**: The updated sensor object or a 404 error if not found.\n\n## Contributing\n\nContributions to improve the API's functionality, reliability, or user experience are welcome. Please submit pull requests or open issues on the project repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielalmir%2Fsmartparking-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielalmir%2Fsmartparking-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielalmir%2Fsmartparking-api/lists"}