{"id":13632505,"url":"https://github.com/vercel/cosmosdb-server","last_synced_at":"2025-05-16T15:06:38.518Z","repository":{"id":40484720,"uuid":"145352978","full_name":"vercel/cosmosdb-server","owner":"vercel","description":"A Cosmos DB server implementation for testing your applications locally.","archived":false,"fork":false,"pushed_at":"2024-09-23T09:25:49.000Z","size":582,"stargazers_count":176,"open_issues_count":27,"forks_count":30,"subscribers_count":62,"default_branch":"main","last_synced_at":"2025-04-24T09:54:09.682Z","etag":null,"topics":[],"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/vercel.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":"2018-08-20T01:49:11.000Z","updated_at":"2025-02-07T02:14:06.000Z","dependencies_parsed_at":"2024-12-06T14:00:52.277Z","dependency_job_id":"f01754fa-89c9-4059-b0df-c90589b2cfad","html_url":"https://github.com/vercel/cosmosdb-server","commit_stats":{"total_commits":171,"total_committers":14,"mean_commits":"12.214285714285714","dds":"0.32163742690058483","last_synced_commit":"27215f46e2c05fd0b89a7a0cdaad361d8e98b008"},"previous_names":["zeit/cosmosdb-server"],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fcosmosdb-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fcosmosdb-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fcosmosdb-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vercel%2Fcosmosdb-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vercel","download_url":"https://codeload.github.com/vercel/cosmosdb-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254003895,"owners_count":21997957,"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-08-01T22:03:05.050Z","updated_at":"2025-05-16T15:06:38.476Z","avatar_url":"https://github.com/vercel.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# cosmosdb-server\n\nA Cosmos DB server implementation for testing your apps locally.\n\n```js\nconst { default: cosmosServer } = require(\"@vercel/cosmosdb-server\");\nconst { CosmosClient } = require(\"@azure/cosmos\");\nconst https = require(\"https\");\n\ncosmosServer().listen(3000, () =\u003e {\n  console.log(`Cosmos DB server running at https://localhost:3000`);\n\n  runClient().catch(console.error);\n});\n\nasync function runClient() {\n  const client = new CosmosClient({\n    endpoint: `https://localhost:3000`,\n    key: \"dummy key\",\n    // disable SSL verification\n    // since the server uses self-signed certificate\n    agent: https.Agent({ rejectUnauthorized: false })\n  });\n\n  // initialize databases since the server is always empty when it boots\n  const { database } = await client.databases.createIfNotExists({ id: 'test-db' });\n  const { container } = await database.containers.createIfNotExists({ id: 'test-container' });\n\n  // use the client\n  // ...\n}\n```\n\nTo choose between listening for HTTP and HTTPS, import the right function.\n\n```js\nconst { createHttpServer, createHttpsServer } = require(\"@vercel/cosmosdb-server\"); \n```\n\nTo run the server on cli:\n\n```sh\ncosmosdb-server -p 3000\n```\n\nor without SSL:\n\n```sh\ncosmosdb-server -p 3000 --no-ssl\n```\n\n## installation\n\n```sh\nnpm install @vercel/cosmosdb-server\n```\n\nIt exposes the `cosmosdb-server` cli command as well.\n\n## API\n\n#### cosmosServer(opts?: https.ServerOptions): https.Server\n\nCreate a new instance of cosmos server. You can pass https server options as the argument.\n\nSee [`https.createServer`](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener) for more information.\n\n## Supported operations\n\n- Database operations.\n- Container operations.\n- Item operations.\n- User-defined function operations.\n- Any SQL queries except the spatial functions `ST_ISVALID` and `ST_ISVALIDDETAILED`. Other spatial functions are supported; however, the `ST_DISTANCE` function uses centroid distances and results may differ from Cosmos DB values.\n\nIt may not support newly added features yet. Please report on the Github issue if you find one.\n\n## Developing\n\nTo build the project, use `yarn build`.\n\nTo run the server from development code, after building, use `node lib/cli.js`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fcosmosdb-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvercel%2Fcosmosdb-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvercel%2Fcosmosdb-server/lists"}