https://github.com/sahithvibudhi/gratis
An open-source, easy-to-customize back-end service right out of the box.
https://github.com/sahithvibudhi/gratis
headless node-js rest-api
Last synced: 4 months ago
JSON representation
An open-source, easy-to-customize back-end service right out of the box.
- Host: GitHub
- URL: https://github.com/sahithvibudhi/gratis
- Owner: sahithvibudhi
- License: apache-2.0
- Created: 2018-11-24T15:45:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T07:38:40.000Z (over 3 years ago)
- Last Synced: 2025-12-20T15:56:41.157Z (6 months ago)
- Topics: headless, node-js, rest-api
- Language: JavaScript
- Homepage:
- Size: 1.59 MB
- Stars: 8
- Watchers: 6
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gratis
An open-source, easy-to-customize back-end service right out of the box. Write your front-end let gratis handle the Back-end. ⚡

1. [Quick Start](#-quick-start)
2. [ How to Use?](#-how-to-use)
3. [How to Setup Project in your local environment?](#-how-to-setup-project-in-your-local-environment)
# 🚀 Quick Start
1. Install Gratis
```
npm install -g gratis-server
```
2. Start server
```
gratis-server --port 9000 --dburl mongodb://localhost:32770 --log true
```
That's it 💁♂️
# 📖 How to Use?
__To Insert Records:__
```
curl --header "Content-Type: application/json" \
--request POST \
--data '{"name":"t-series","subscribers":"78,000,000", "region":"asia"}' \
http://localhost:3000/youtube/channels
```
---
__To Fetch Records:__
```
curl --request GET \
http://localhost:3000/youtube/channels
# returns max 20 records
```
Querying data
```
curl --request GET \
http://localhost:3000/youtube/channels?region=asia&sort=-subscribers&limit=5
```
---
__To Update Records:__
```
curl --header "Content-Type: application/json" \
--request POST \
--data '{"name":"t-series","subscribers":"79,000,000", "region":"asia"}' \
http://localhost:3000/youtube/channels?name=t-series
```
---
__To Delete Recrods:__
```
curl --request DELETE \
http://localhost:3000/youtube/channels?name=t-series
```
---
## How to Setup Project in your local environment?
```
git clone https://github.com/sahithvibudhi/gratis.git
cd gratis
npm install
npm start
# or
docker-compose up
```
> NOTE: Gratis needs a MongoDB server to store the data 💾.
To run it on a specific port. use:
```
node index.js --port 9000
```
To pass the database connection URL. use:
```
node index.js --port 9000 --dburl mongodb://localhost:32770
```
To enable logging, use:
```
node index.js --port 9000 --dburl mongodb://localhost:32770 --log true
```
Gratis comes with a GUI to create new apps, to enable, use:
```
node index.js --dburl mongodb://localhost:32770 --log true --dashboard true
```
# TODO:
- Adapter to use different Data Stores
- Adapter to use different loggers
- Make auth Optional
---
Built with ❤️ for front-end Developers