{"id":19297391,"url":"https://github.com/q84mahdi/Deploy-JSON-Server-On-Vercel","last_synced_at":"2026-07-03T01:30:23.291Z","repository":{"id":261203168,"uuid":"883590848","full_name":"mahdi-q/Deploy-JSON-Server-On-Vercel","owner":"mahdi-q","description":"Deploy JSON Server on Vercel  ","archived":false,"fork":false,"pushed_at":"2024-11-05T08:44:42.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-05T22:09:38.326Z","etag":null,"topics":["deployment","json-server","restful-api","vercel","vercel-deployment"],"latest_commit_sha":null,"homepage":"https://deploy-json-server-on-vercel-template.vercel.app","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/mahdi-q.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-11-05T08:33:57.000Z","updated_at":"2024-11-05T08:48:20.000Z","dependencies_parsed_at":"2025-01-27T17:01:27.689Z","dependency_job_id":null,"html_url":"https://github.com/mahdi-q/Deploy-JSON-Server-On-Vercel","commit_stats":null,"previous_names":["mahdi-q/deploy-json-server-on-vercel"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdi-q%2FDeploy-JSON-Server-On-Vercel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdi-q%2FDeploy-JSON-Server-On-Vercel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdi-q%2FDeploy-JSON-Server-On-Vercel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdi-q%2FDeploy-JSON-Server-On-Vercel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahdi-q","download_url":"https://codeload.github.com/mahdi-q/Deploy-JSON-Server-On-Vercel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240400338,"owners_count":19795332,"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":["deployment","json-server","restful-api","vercel","vercel-deployment"],"created_at":"2024-11-09T23:04:25.434Z","updated_at":"2026-07-03T01:30:23.246Z","avatar_url":"https://github.com/mahdi-q.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deploy JSON Server on Vercel\n\nThis repository contains a simple setup for deploying a `json-server` instance to Vercel. `json-server` provides a full fake REST API with zero coding, and by deploying it to Vercel, you can have a quick and scalable API solution.\n\n## Prerequisites\n\n1. **Node.js**: Ensure you have Node.js installed (preferably the latest stable version).\n2. **Vercel Account**: Sign up at [vercel](https://vercel.com) and install the `Vercel CLI` if desired.\n\n## Project Setup\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/mahdi-q/Deploy-JSON-Server-On-Vercel.git\n   ```\n2. Navigate to the project directory:\n   ```bash\n   cd Movie-Character-App-Project\n   ```\n3. Install the dependencies:\n   ```bash\n   npm install\n   ```\n\n## Project Structure\n\n- `api/server.js`: This file contains the json-server setup and routes configuration.\n- `vercel.json`: Configuration file for Vercel to customize deployment settings.\n\n## Key Files\n\n- `api/server.js`:\n  - Configures json-server to use an in-memory database.\n  - Sets up routing and middleware for a simple JSON API.\n- `vercel.json`:\n  - Directs Vercel to deploy server.js as a serverless function.\n  - Sets up rewrites to make the server accessible via the root URL.\n\n## Vercel Deployment\n\n1. **Push to GitHub**: Push your project to GitHub if it’s not there already.\n\n2. **Link with Vercel**:\n\n   - Go to your Vercel dashboard.\n   - Select New Project and import your GitHub repository.\n   - In the project settings, Vercel should automatically detect the vercel.json configuration.\n\n3. **Deploy**:\n   - Vercel will deploy the project using the configurations specified.\n   - After deployment, you should see your JSON server running at https://deploy-json-server-on-vercel-template.vercel.app.\n\n## Example Requests\n\nOnce deployed, you can use the following example requests:\n\n- GET `/posts`: Fetches all posts.\n- POST `/posts`: Creates a new post.\n- PUT `/posts/:id`: Updates an existing post.\n- DELETE `/posts/:id`: Deletes a post.\n\n## Sample Database (Embedded)\n\nThe `api/server.js` file contains an embedded sample database to avoid file system issues on Vercel. You can update this database to suit your application needs.\n\nExample in-memory data structure:\n\n```bash\nconst db = {\n  posts: [\n    { id: \"1\", title: \"a title\", views: 100 },\n    { id: \"2\", title: \"another title\", views: 200 },\n  ],\n  comments: [\n    { id: \"1\", text: \"a comment about post 1\", postId: \"1\" },\n    { id: \"2\", text: \"another comment about post 1\", postId: \"1\" },\n  ],\n  profile: {\n    name: \"typicode\",\n  },\n};\n```\n\n## Additional Notes\n\n- This configuration uses `json-server` with an in-memory database, which resets on each deployment or server restart.\n\n## Refrences \u0026 Tools\n\n- https://github.com/typicode/json-server\n- https://vercel.com/docs\n- https://chatgpt.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fq84mahdi%2FDeploy-JSON-Server-On-Vercel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fq84mahdi%2FDeploy-JSON-Server-On-Vercel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fq84mahdi%2FDeploy-JSON-Server-On-Vercel/lists"}