Skip to content

Open-source marketplace backend in Node.js, empowering Web platforms with Search API, Automation, Auth, Headless CMS… ⚡ 💻

License

Notifications You must be signed in to change notification settings

arunjayakumar01/stelace

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stelace platform runner

Open-source backend and API stack empowering dev teams to build, run and scale enduring platforms and marketplaces faster than ever.

Stelace.com | Documentation | Blog | Twitter


Stelace API Server

Includes:

For a full-stack experience, you can get started here with open-source Vue.js front-end templates.

CircleCI FOSSA Status JavaScript Style Guide Conventional Commits


Stelace as-a-service

The easiest way to deploy and leverage Stelace is with our official managed infrastructure. You can have a fresh platform backend up and running in minutes with high-availability deployment, automatic scaling, built-in test and live environments and admin dashboard. SLA, dedicated infrastructure and premium support are also available for Enterprise customers.


Contents

Built to last

With:

What is included

All APIs listed in docs and API Reference.

Admin Dashboard UI is tied with our Software-as-a-Service offer and is not open-source. It certainly won’t ever be unless community and staff collaborate to make this happen.

That’s it!

This means you can freely switch between any of our SaaS plans and self-hosting at any time if you don’t need Stelace support or SLA and you’re ready to build your own admin UI, or you don’t need one 👓.

Note: for your app UI, we also crafted open-source front-end templates.

marketplace-demo-screenshot

Setup

Docker

Please go to Docker website to install Docker CE/EE. Choose the right installation guide for your system.

Install yarn

Please refer to official instructions.

Clone

git clone https://github.com/stelace/stelace.git && cd stelace && git checkout origin/master

Development

We recommend using pre-configured Docker images for databases to ease development.

It’s how Stelace team develops and tests API server.

Please note that you should use proper databases in production though.

Let’s start with your own .env file to customize if needed:

cp .env.example .env

Start development databases

Build the Docker images:

docker-compose build

And start the databases:

yarn docker:db

Shorthand for: docker-compose up -d elasticsearch postgresql redis

Run server

  • Run yarn to install dependencies.

  • Run the database migration to automatically create or update tables:

yarn knex migrate:latest # or `npm run knex migrate:latest`
yarn plugins
  • You can also seed the database with hard-coded development API keys, so you can always use the same keys for development with local server:
yarn seed

Tip: use one of our Stelace Instant open-source templates for blazing fast full-stack development.

  • Start the server:
yarn start # or `npm start`

Develop with API server container

Stelace server is built on and deployed to Linux machines (Ubuntu), and you may have some trouble running server with another OS.

Docker can solve this with ease.

You just have to change host from 127.0.0.1 to elasticsearch, postgresql and redis in your .env file when using containerized API and databases.

Here is how you can install dependencies and init database:

# ephemeral container with --rm option
docker-compose run --rm api yarn
docker-compose run --rm api yarn seed

Note: project root directory is used as a Docker volume during development, including node_modules that are shared. You need to re-install dependencies when switching between plain server and server container setups.

Run:

docker-compose up -d

Useful commands to run from project root:

  • Follow logs of a API container

docker-compose logs -f api

  • Stop and remove containers

docker-compose down

  • Remove volumes (can be useful to solve dev issues with corrupted data or after database upgrade)

docker volume prune

Tip: Use yarn docker:db:reset to reset containers and volumes during development. This can be useful if you have any issue with corrupted database or redis store data, or if you want to upgrade databases (warning: containers data & volumes will be lost).

Tests

Tests are mostly integration tests with databases up and running to cover full API functionality.

Run npm run test or yarn test with ElasticSearch, PostgreSQL and Redis running and appropriate environment variables (hosts, ports, credentials).

You can use database Docker containers (see Using API server container) with appropriate host (127.0.0.1) and ports (e.g. PostgreSQL: 6543).

Tests files are run in parallel with AVA, using multiple schemas in PostgreSQL database.

Tests are quite CPU-intensive and you probably want to have 4 CPU cores to run them in good conditions.

Please find more details in server docs (testing).

Logs

Getting server logs in real-time can be very useful during development or tests.

You just have to set an environment variable:

ROARR_LOG=true yarn test

To see the output of console.log calls during AVA tests, add --verbose flag:

yarn test --verbose

Using API server container

Stelace team uses an API server Docker image in production, so do CI tests.

You can use an API server container to run tests locally too.

Ensure ElasticSearch, PostgreSQL and Redis are running once you’ve started database containers:

# Install dependencies used by API server container if not done yet
docker-compose run --rm api yarn
# Checking that databases are up and running
docker-compose run --rm api /bin/sh -c \
'until nc -z -v -w30 elasticsearch 9200 && nc -z -v -w30 postgresql 5432 && nc -z -v -w30 redis 6379
do
  echo "Waiting for PostgreSQL, ElasticSearch and Redis…"
  sleep 2
done';

Run tests with containerized API:

docker-compose run --rm api yarn test
# instead of standard local server with `yarn test`

Production

As mentioned above, we recommend using proper databases for production. You may self-host the databases or externalize them by using database providers.

Please find detailed procedures to configure SSL for database.

Versioning

Stelace API public versions introducing breaking changes are publicly dated like 2019-05-20 but the repository itself follows semver rules. Dated version are the equivalent of major updates, as in semver major.minor.patch.

Old dated versions are supported thanks to transformers, inspired by great examples.

When introducing breaking changes (denoted by a new major version in this repository according to semver):

  • Dated version is added to src/versions/index.js
  • Appropriate transformers are added to request, response and validation subfolders
  • Changes are documented using a description field in request transformers
  • Conventional commit messages are used to keep track of breaking changes

Contributing

Stelace is open source and contributions from the community are most welcome, including yours!

Before contributing to Stelace:

  1. You’ll be prompted to read and sign our Contributor License Agreement, which ensures we can maintain appropriate governance of the project as a community in the long run.
  2. Dig into CONTRIBUTING.MD, about submitting issues, requesting new features, etc.
  3. Ensure we collaborate with mutual respect.

Dependencies

FOSSA Status

License

Stelace API server for Web platforms is licensed under the terms of the GNU General Public License Version 3.

Please contact us to discuss other licensing options or have look at our SaaS plans for hosted backend and premium support.

Stelace Copyright © 2018-present Sharinplace SAS.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License is included in this program, and is also available at https://www.gnu.org/licenses/gpl-3.0.txt.

We care about open-source

Made with ❤️ in Paris, France.

About

Open-source marketplace backend in Node.js, empowering Web platforms with Search API, Automation, Auth, Headless CMS… ⚡ 💻

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.3%
  • HTML 2.0%
  • Other 0.7%