{"id":13565510,"url":"https://github.com/axept/open-parse","last_synced_at":"2025-04-03T22:31:38.124Z","repository":{"id":57315098,"uuid":"48177257","full_name":"axept/open-parse","owner":"axept","description":"Get RESTful API to your data store, schemas, users and security management and bring up your own BaaS in a few minutes","archived":false,"fork":false,"pushed_at":"2015-12-28T12:37:39.000Z","size":30,"stargazers_count":51,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-21T12:57:31.426Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/axept.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-17T13:56:38.000Z","updated_at":"2024-05-04T06:46:41.000Z","dependencies_parsed_at":"2022-09-12T15:01:16.493Z","dependency_job_id":null,"html_url":"https://github.com/axept/open-parse","commit_stats":null,"previous_names":["startupmakers/open-parse"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axept%2Fopen-parse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axept%2Fopen-parse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axept%2Fopen-parse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axept%2Fopen-parse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axept","download_url":"https://codeload.github.com/axept/open-parse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247090261,"owners_count":20881940,"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-01T13:01:48.743Z","updated_at":"2025-04-03T22:31:37.809Z","avatar_url":"https://github.com/axept.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Open Parse\n\n[![NPM Version](https://img.shields.io/npm/v/open-parse.svg)](https://npmjs.org/package/open-parse)\n[![NPM Downloads](https://img.shields.io/npm/dm/open-parse.svg)](https://npmjs.org/package/open-parse)\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/StartupMakers/open-parse.svg)](http://isitmaintained.com/project/StartupMakers/open-parse \"Average time to resolve an issue\")\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/StartupMakers/open-parse.svg)](http://isitmaintained.com/project/StartupMakers/open-parse \"Percentage of issues still open\")\n\n\u003e Open Parse = [Parse.com](https://parse.com/docs/rest/guide) + [JSON API](http://jsonapi.org/format/) + [koa](https://github.com/koajs/koa)\n\nThe collection of middleware which provides flexible RESTful API for accessing to application data store and schemas, users and security management. Save your time to bootstrap new web and mobile projects.\n\nOpen Parse is open source BaaS (Backend as a Service). On the schema below that is \"Data Proccessing / Management\":\n\n![BaaS](https://backendless.com/wp-content/uploads/2014/01/baas-apis.png)\n\nOut of the box **Open Parse** supports:\n\n* [bunyan-logger](https://github.com/trentm/node-bunyan) which could be connected to Logentries, Loggly, NewRelic and other cloud log management services just in a 15 seconds.\n\n* [MongoDB](https://github.com/gordonmleigh/promised-mongo) as default data provider. But you could implement custom data providers for any other databases (it takes ~20 min). \n\nBuilt with love to [Functional Principles](https://drboolean.gitbooks.io/mostly-adequate-guide/content/) and.. yes, koa.\n\n## Content\n\n* [How it works?](#how-it-works)\n* [Installation](#installation)\n* [Basic usage](#basic-usage)\n* [FAQ](#faq)\n  + [How to connect a Cloud Log Service?](#how-to-connect-a-cloud-log-service)\n* [Inspiration](#inspiration)\n* [Contribution](#contribution)\n* [Roadmap](#roadmap)\n\n\n## How It Works?\n\nOpen Parse is incredibly simple. It's just a glue which is connecting 2 pieces:\n\n* *Middleware* to get RESTful API end-point on your web server. It's implemented according to [JSON API](http://jsonapi.org/) specification.\n* *Data Providers* to work with any data storage (by default is MongoDB).\n\nYou can extend any of those points.\n\n## Installation\n\n```bash\nnpm install --save open-parse\n```\n\n## Basic Usage\n\nThe following example has been written with using [promised-mongo](https://github.com/gordonmleigh/promised-mongo) and [koa-router](https://github.com/alexmingoia/koa-router) packages. \n\n### Setup the environment\n```javascript\nimport Router from 'koa-router';\nimport pmongo from 'promised-mongo';\n\nconst router = new Router();\nconst db = new pmongo('localhost/my-app');\n\nconst dataRequired = function *(next) {\n  if (typeof this.request.body['data'] === 'object') {\n    yield next;\n  } else {\n    this.throw(400, 'Request data is required');\n  }\n};\n```\n\n### Bring up Users API\n```javascript\nconst users = {\n  dataProvider: new UsersDataProvider({\n    collection: db.collection('users')\n  })\n};\nrouter.post('/users', dataRequired, handleUserSignUp(users));\nrouter.get('/login', handleUserLogin(users));\nrouter.post('/logout', handleUserLogout(users));\nrouter.get('/users/me', handleUserFetch(users));\n```\n\n### Bring up Classes API\n\nIn this example we're using a local data from JSON file.\n\n```javascript\nconst classes = {\n  dataProvider: new ObjectsDataProvider({\n    collection: db.collection('objects'),\n    initialCache: require('./cached-objects.json')\n  }),\n};\nrouter.post('/classes/:className', dataRequired, handleObjectCreate(classes));\nrouter.get('/classes/:className', handleObjectsList(classes));\nrouter.get('/classes/:className/:objectId', handleObjectFetch(classes));\nrouter.patch('/classes/:className/:objectId', dataRequired, handleObjectUpdate(classes));\nrouter.delete('/classes/:className/:objectId', handleObjectDelete(classes));\n```\n\nFor `ObjectsDataProvider` an initial cache should be specified as a `[className][objectId]` hash object:\n  \n`cached-objects.json`\n```\n{ \n  \"company\": {\n    \"our\": {\n      \"title\": \"Startup Makers\",\n      \"about\": \"We are consulting and outsourcing a web-development with cutting-edge JavaScript technologies (ES6, Node.js, React, Redux, koa)\"\n    }\n  }\n}\n```\n\n### Bring up Schemas API\n\n```javascript\nconst schemas = {\n  dataProvider: new SchemasDataProvider({\n    collection: db.collection('schemas')\n  })\n};\nrouter.get('/schemas/:className', handleSchemaFetch(schemas));\n```\n\n### Connect the router to your application\n\n```javascript\nimport koa from 'koa';\nimport cors from 'kcors';\nimport qs from 'koa-qs';\nimport bodyParser from 'koa-bodyparser';\nimport mount from 'koa-mount';\n\n// Create the server instance\nconst app = koa();\napp.use(cors());\nqs(app);\napp.use(bodyParser());\n\n// ...paste your routes here...\n\n// Connect API router\napp.use(mount('/api', router));\n\n// Go LIVE\napp.listen(process.env['PORT'] || 3000);\n```\n\n### Work with Open Parse API from the browser or mobile apps\n\nFor example how to implement login in your browser scripts when you have connected Open Parse:\n\n```javascript\nconst login = (email, password) =\u003e {\n  const loginURL =\n    '/api/login'\n    + '?email=' + encodeURIComponent(email)\n    + '\u0026password=' + encodeURIComponent(password);\n  fetch(loginURL, {\n    headers: {\n      'Accept': 'application/json',\n    },\n    credentials: 'same-origin'\n  }).then((response) =\u003e response.json()).then((body) =\u003e {\n    if (body['data']) {\n      const userId = body['data']['id'];\n      const userName = body['data']['attributes']['name'];\n      console.log('Logged as user %s (%s)', userName, userId);\n    } else {\n      body['errors'].forEach(error =\u003e\n        console.error('Auth error: %s (%s)', error['title'], error['source']['parameter'])\n      );\n    }\n  });\n};\n```\n\n## FAQ\n\n### How To Connect a Cloud Log Service?\n\nIt's really easy. Did you initialize a logger? If you didn't, let's do it right now:\n\n```javascript \nimport bunyan from 'bunyan';\nimport { LogentriesBunyanStream } from 'bunyan-logentries';\n\nconst logger = bunyan.createLogger({\n  name: 'awesome-app',\n  streams: {\n    stream: new LogentriesBunyanStream({\n      token: process.env['LOGENTRIES_TOKEN']\n    }),\n    level: 'debug',\n    type: 'raw'\n  }\n});\n```\n\nAdd just a one line to your code\n\n```javascript\nconst users = {\n  dataProvider: new UsersDataProvider({\n    collection: db.collection('users')\n  }),\n  logger // THIS LINE!\n};\nrouter.post('/users', dataRequired, handleUserSignUp(users));\nrouter.get('/login', handleUserLogin(users));\nrouter.post('/logout', handleUserLogout(users));\nrouter.get('/users/me', handleUserFetch(users));\n```\n\nThat's all. You will get a messages (about login, logout and fetching the data about users) in your Logentries account.\n\n# Inspiration\n\n* [Parse.com](https://parse.com/docs/rest/guide) - Commercial Backend-as-a-Service platform\n* [BaasBox API](http://www.baasbox.com/documentation/?shell#api) - Java-based open source Backend-as-a-Service solution\n* [DeployD API](http://docs.deployd.com/api/) - first generation open source BaaS platform\n* [Sails.js](http://sailsjs.org/documentation/concepts/) - first generation MVC framework for Node.js\n* [Reindex.io](https://www.reindex.io/docs/) - Commercial BaaS platform with GraphQL API\n* [Serverless](https://github.com/serverless/serverless) - Hmm?\n\nWould you like get some features from solutions above? [Ask me](https://github.com/StartupMakers/open-parse/issues/new) or create a Pull Request.\n\n# Contribution\n\nAre you ready to make the world better?\n\n**1.** Fork this repo\n\n**2.** Checkout your repo:\n\n```bash\ngit clone git@github.com:YourAccount/open-parse.git\n```\n\n**3.** Create your feature (or issue) branch:\n \n```bash\ngit checkout -b my-new-feature\n```\n\n**4.** Commit your changes:\n\n```bash\ngit commit -am 'Add some changes'\n```\n\n**5.** Push to the branch:\n\n```bash\ngit push origin my-new-feature\n```\n\n**6.** [Create new pull request](https://github.com/StartupMakers/open-parse/compare)\n\nThank you very much. Your support is greatly appreciated.\n\n# Roadmap\n\n**Version 0.2**\n\n* Support access control layer (ACL)\n* Add real world example\n* Improve the documentation and architecture schema\n* Add 'Access-Control-Allow-Origin' header\n\n**Version 0.3**\n\n* Add Express middleware adapter\n* Support jobs feature\n* Support e-mail service\n\n**Version 0.4**\n\n* Add client SDK for JavaScript and React Native\n* Support files feature\n\n**Version 0.5**\n\n* Support web hooks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxept%2Fopen-parse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxept%2Fopen-parse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxept%2Fopen-parse/lists"}