Space Cloud is an open source, high performance web server which provides instant realtime APIs on the database of your choice. Build Internet Scale apps with the agility of a prototype!
Table of Contents
- About Space Cloud
- How it works
- Design Goals
- Getting started
- Support & Troubleshooting
About Space Cloud
Note: Space Cloud is still in Beta.
Space Cloud is essentially a web server which automatically integrates with an existing or a new database to provide instant realtime APIs over REST, websockets, gRPC, etc. Written in Golang, it provides a high throughput layer for your backend services. It's completely unopinionated and works with the tech stack of your choice.
In a nutshell, Space Cloud provides you with all of the following without having to write a single line of backend code:
- Instant Realtime APIs to consume directly from your frontend.
- Authentication and authorization baked in by default.
- Freedom from vendor lock ins.
- Flexibility to work with the tech stack of your choice.
- Various pre-built modules such as User Management, Realtime CRUD and File Storage.
How it works
Space Cloud is meant to replace any backend php, nodejs, java code you may write to create your endpoints. Instead it exposes your database over an external API which can be consumed directly from the frontend. In other words, it allows clients to fire database queries directly.
However, it's important to note that the client does not send database (SQL) queries to Space Cloud. Instead it sends an object describing the query to be executed. This object is first validated by Space Cloud (using security rules). Once the client is authorized to make the request, a database query is dynamically generated and executed. The results are send directly to the concerned client.
We understand that not every app can be built using only CRUD operations. Sometimes it's necessary to write business logic. For such cases, Space Cloud offers you APIs to write
functions (which runs as microservices alongside Space Cloud). These
functions can be invoked from the frontend or by other
function. In this scenario, Space Cloud acts merely as an api gateway between your
functions and the client.
Apart from these, Space Cloud also integrates with tons of cloud technologies to give you several other features like
realtime database (changes in the database are synced with all concerned clients in realtime),
file storage, etc.
There are a lot of design decisions taken by us while creating Space Cloud. These form the guiding principles which heavily influence the roadmap ahead. Understanding them would also make our objectives of creating Space Cloud a lot more clear.
Ease of use
The main reason Space Cloud was born was to simplify the app / web development process. Right from making simple CURD operations to syncing data reliably in a distributed environment, everything must be as simple as a function call. This is the prime reason we chose to have a consistent API across all the databases / technologies we support.
This also means, that Space Cloud needs to be as unopinionated as possible to reuse the existing skill sets and tech you might be well versed with.
We take security a bit too seriously. In fact we are close to being paranoid about it. All products built with Space Cloud must be highly secure.
The idea of exposing your database over a public API doesn't sound like a good one. But to make sure we can do it in a secure manner, we have added a powerful yet flexible feature called
security rules. These
security rules (written in JSON or YAML) along with JWT tokens help you take care of a wide variety of authentication and authorization problems.
We believe that each app built with Space Cloud, must be extremely robust and future proof. We shall never comprise on the robustness of the platform at any cost. This also implies that we need to maintain strict backward compatibility.
Leverage the existing tools
The goal of this project is not to re-invent the wheel over and over again. In fact, integration with proven technologies is preferred over implementing them ourselves. For example, we are using Apache Kafka under the hood, to make our
realtime database feature reliable. Also, Nats is used to implement the
functions modules for high throughput and scale.
We are working hard to document every aspect of Space Cloud to give you the best onboarding experience. Here are links to the various docs we have:
Let's see how to build a realtime todo app using Space Cloud
Note: MongoDB is not a dependency of Space Cloud. The sample app in this quick start uses MongoDB as it's database.
Step 1: Download Space Cloud
The first step is to download the
space-cloud binary. This binary is the server creating the endpoints and connecting to your database. You need to download binary for your operating system or you could build it directly from its source code. You will need go version 1.11.2 or later to build it from source.
Download the binary for your OS from here:
You can unzip the compressed archive
For Linux / Mac:
For Windows: Right click on the archive and select
space-cloud binary executable and add it to your path.
For Linux / Mac:
chmod +x space-cloud
Step 2: Download the config file
Space Cloud needs a config file in order to function properly. It relies on the config file to load information like the database connection string, security rules, etc.
You can find a sample config for the todo app here. Feel free to explore the file.
Step 3: Start Space Cloud
You can start
space-cloud with the following command. Make sure MongoDB is running before this step.
For Linux / Mac:
./space-cloud run --config config.yaml
space-cloud.exe run --config config.yaml
That's it. Your backend is up and running!
Step 4: Download the TODO App
Open it in two different windows by double clicking the html file twice, login into both and then try adding some todos to see the magic.
Support & Troubleshooting
The documentation and community will help you troubleshoot most issues. If you have encountered a bug or need to get in touch with us, you can contact us using one of the following channels:
- Support & feedback: Discord
- Issue & bug tracking: GitHub issues
- Follow product updates: @spaceuptech
Space Cloud is a young project. We'd love to have you on board if you wish to contribute. To help you get started, here are a few areas you can help us with:
- Writing the documentation
- Making sample apps in React, Angular, Android, and any other frontend tech you can think of
- Deciding the road map of the project
- Creating issues for any bugs you find
- And of course, with code for bug fixes and new enhancements
Space Cloud is Apache 2.0 licensed.