Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

Commit f5cb35c

Browse files
committed
updated README and added pkg to Makefile
1 parent 5985909 commit f5cb35c

File tree

3 files changed

+163
-67
lines changed

3 files changed

+163
-67
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
mongodata/
33
cmd/staticbackend
44

5+
dist/
6+
57
# Binaries for programs and plugins
68
*.exe
79
*.exe~

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,17 @@ deploy:
1212
scp staticbackend sb-poc:/home/dstpierre/sb
1313

1414
test:
15-
@JWT_SECRET=okdevmode go test --race --cover ./...
15+
@JWT_SECRET=okdevmode go test --race --cover ./...
16+
17+
pkg: build
18+
@rm -rf dist/*
19+
@echo "building linux binaries"
20+
@CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o dist/binary-for-linux-64-bit
21+
@CGO_ENABLED=0 GOARCH=386 GOOS=linux go build -o dist/binary-for-linux-32-bit
22+
@echo "building mac binaries"
23+
@CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -o dist/binary-for-mac-64-bit
24+
@echo "building windows binaries"
25+
@CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -o dist/binary-for-windows-64-bit.exe
26+
@CGO_ENABLED=0 GOARCH=386 GOOS=windows go build -o dist/binary-for-windows-32-bit.exe
27+
@echo "compressing binaries"
28+
@gzip dist/*

README.md

Lines changed: 147 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,105 +5,186 @@
55
# StaticBackend - simple backend for your apps
66

77
[StaticBackend](https://staticbackend.com) is a simple backend that handles
8-
user management, database, file storage, and real-time experiences via
8+
user management, database, file storage, forms, and real-time experiences via
99
channel/topic-based communication for web and mobile applications.
1010

1111
You can think of it as a lightweight Firebase replacement you may self-host. No
12-
vendor lock-in, and your data stays in your control. You may contribute to the
13-
product.
12+
vendor lock-in, and your data stays in your control.
1413

15-
We've decided to open the core of the product and have a permissive license
16-
with the MIT license.
14+
### Table of content
1715

18-
We [provide a CLI](https://staticbackend.com/getting-started/) for local
19-
development if you want to get things started without any infrastructure and
20-
for prototyping.
16+
* [What can you build](#what-can-you-build)
17+
* [How it works / dev workflow](#how-it-works-dev-workflow)
18+
* [Get started with the self-hosted version](#get-started-with-the-self-hosted-version)
19+
* [Documentation](#documentation)
20+
* [Librairies & CLI](#libraries-cli)
21+
* [Examples](#examples)
22+
* [Deploying in production](#deploying-in-production)
23+
* [Feedback & contributing](#feedback-contributing)
24+
* [Open source, sponsors, paid SaaS](#open-source-sponsors-paid-saas)
25+
* [Spread the words](#spread-the-words)
26+
27+
28+
## What can you build
29+
30+
I built StaticBackend with the mindset of someone tired of writing the same code
31+
over and over on the backend. If you're application needs one or all of
32+
user management, database, file storage, real-time interactions, it should be
33+
a good fit.
34+
35+
I'm personally using it to build SaaS.
36+
37+
## How it works / dev workflow
38+
39+
The main idea is that StaticBackend is your backend API for your frontend apps.
40+
41+
It needs to have access to MongoDB and Redis servers. Once you have your instance
42+
running you create accounts for your applications.
43+
44+
An account has its own database, file storage, etc.
45+
46+
I think `app` might have been a better name instead of `account`. Naming things
47+
is hard.
48+
49+
A StaticBackend account(app) can have multiple user accounts and each user
50+
accounts may have multiple users.
51+
52+
From there each users can create database documents that are by default Read/Write
53+
for the owner (the user) and Read for its parent account. You may customize
54+
permission for each of your collection (see that later in the documentation).
55+
56+
From here you have the basics building blocks to create a typical web
57+
application. You have all your CRUD and data query operations cover, file
58+
storage and websocket-like capabilities.
59+
60+
We have a [JavaScript](https://www.npmjs.com/package/@staticbackend/js) to
61+
get started quickly. We have also server-side libraries for Node and Go atm.
62+
63+
Why would you need server-side libraries, was it not suppose to be a backend
64+
for client-side application.
65+
66+
Yes, but, there's always a but. Sometimes your application will need to
67+
perform tasks on behalf of users or public user that do not have access to
68+
perform CRUD from the client-side.
69+
70+
Let's imagine we're building an invoicing app. Here's the major entities
71+
we have for this examples:
72+
73+
* A StaticBackend account (our app inside our SB instance)
74+
* An account with 2 users (this would be your customer)
75+
* An invoices collection (where your customer create invoice)
76+
* A clients collection (Your customer send invoice to their clients)
2177

22-
### Run locally
78+
Now let's imagine our customer (our app user) sends an invoice to their Client.
2379

24-
You'll need docker (or access to a MongoDB and Redis instances).
80+
Their client does not have any user account, but they need to see their invoice
81+
when they click on the unique link on their email they received.
2582

26-
1. Clone this repository
83+
This can be achieve via a backend function. Couple of ways:
2784

28-
```shell
29-
$> git clone git@github.com/staticbackendhq/core.git
30-
```
85+
* The email the client received can be directly a unique URL pointing to a
86+
function as a service hosted somewhere. (We will have functions soon).
87+
* Or it could be pointing to your client-side app and you perform a call to
88+
a serverless function you're hosting somewhere.
3189

32-
2. In a terminal start the docker services
90+
The function will be able to perform a Read operation using a special `Root Token`.
3391

34-
```shell
35-
$> docker-compose up
36-
```
92+
This Root Token allow your system to do anything in the server-side.
3793

38-
3. Create a file named `.env` with the following environment variables:
94+
I hope I did not lost the majority of people here ;)
3995

40-
```
41-
APP_ENV=dev
42-
DATABASE_URL=localhost
43-
FROM_EMAIL=you@domain.com
44-
FROM_NAME=your-name
45-
JWT_SECRET=something-here
46-
AWS_ACCESS_KEY_ID=your-aws-key
47-
AWS_SECRET_ACCESS_KEY=your-aws-secret
48-
AWS_SECRET_KEY=your-aws-key
49-
AWS_SES_ENDPOINT=https://email.us-east-1.amazonaws.com
50-
```
96+
This is one example of your typical day-to-day workflow using StaticBackend.
5197

52-
3. Compile and run the API server
98+
## Get started with the self-hosted version
5399

54-
```shell
55-
$> make start
56-
```
100+
Please refer to this [guide here](https://staticbackend.com/getting-started/self-hosting/).
57101

58-
### Usage
102+
## Documentation
59103

60-
You have multiple options to use the backend:
104+
We're trying to have the best experience possible reading our documentation.
61105

62-
* You may use our server-side client libraries (currently
63-
[Go](https://github.com/staticbackendhq/backend-go) and [Node](https://github.com/staticbackendhq/backend-node))
64-
* From your client-side applications using our [JavaScript library](https://github.com/staticbackendhq/backend-js)
65-
* You may use your own HTTP client
106+
Please help us improve if you have any feedback.
66107

67-
To start using the backend you'll need to create an account on your local
68-
instance.
108+
**Documentation with example using our libraries or curl**:
69109

70-
You'll need to [install our CLI](https://staticbackend.com/getting-started/) and
71-
have it running in local mode so it will talk to your local backend instance.
110+
* [Introduction and authentication](https://staticbackend.com/docs/)
111+
* [User management](https://staticbackend.com/docs/users/)
112+
* [Database](https://staticbackend.com/docs/database/)
113+
* [Real-time communication](https://staticbackend.com/docs/websocket/)
114+
* [File storage](https://staticbackend.com/docs/storage/)
115+
* [Forms](https://staticbackend.com/docs/forms/)
72116

73-
```shell
74-
$> backend account create you@domain.com
75-
```
117+
## Librairies & CLI
76118

77-
Make sure you use a real domain and make sure you're all set sending email
78-
via your AWS account.
119+
We [provide a CLI](https://staticbackend.com/getting-started/) for local
120+
development if you want to get things started without any infrastructure and
121+
for prototyping.
122+
123+
You can use the CLI to manage your database and form submission. This is the
124+
only interface we currently have to interact with your database, other than via
125+
code. There will be a web UI available before v1.0 is released.
126+
127+
We have a page listing our
128+
[client-side and server-side libraries](https://staticbackend.com/docs/libraries/).
129+
130+
## Examples
79131

80-
In `dev` mode emails are printed to the stdout so you will see the account
81-
information for your new database account.
132+
If you'd like to see specifics examples please let us know via the
133+
[Discussions](https://github.com/staticbackendhq/core/discussions) tab.
82134

83-
Once you have those info you're ready to start calling the API from client-side
84-
or server-side application.
135+
Here's the examples we have created so far:
85136

86-
Refer to [our main documentation](https://staticbackend.com/docs/) for more
87-
information.
137+
* [To-do list example](https://staticbackend.com/getting-started/)
138+
* [Realtime collaboration](https://staticbackend.com/blog/realtime-collaboration-example/)
88139

89-
### Deploying in production
140+
## Deploying in production
90141

91142
We've not written anything yet regarding deploying, but once you have the
92-
`core` built into a binary and have access to MongoDB and Redis in production you
143+
core` built into a binary and have access to MongoDB and Redis in production you
93144
should be able to deploy it like any other Go server.
94145

95146
We'll have documentation and an example soon for deploying to DigitalOcean.
96147

97-
### Contributing
148+
## Feedback & contributing
149+
150+
If you have any feedback (good or bad) we'd be more than happy to talk. Please
151+
use the [Discussions](https://github.com/staticbackendhq/core/discussions) tab.
152+
153+
Same for contributing. The easiest is to get in touch first. We're working
154+
to make it easier to contribute code. If you'd like to work on something
155+
precise let us know.
156+
157+
todoici
158+
159+
160+
161+
162+
163+
164+
We've decided to open the core of the product and have a permissive license
165+
with the MIT license.
166+
167+
168+
## Open source, sponsors, paid SaaS
169+
170+
You may read here
171+
[why we've decided to open source StaticBackend](https://staticbackend.com/blog/open-source-backend-as-a-service/).
172+
173+
Hopefully we can start getting sponsorship so the open source version development
174+
and future is secure.
175+
176+
We're also offering paid subscription for a
177+
[fully managed](https://staticbackend.com/blog/open-source-backend-as-a-service/)
178+
version of SB.
98179

99-
This is still pre-v1 and API _might_ change. All contributions highly appreciated,
100-
please make sure to discuss before starting anything.
180+
## Spread the words
101181

102-
### Roadmap
182+
It would means the world to us if you could help us spread the words about
183+
StaticBackend. A tweet, a blog post, any visibility is helpful and I (Dominic)
184+
personally thanks you for this.
103185

104-
We've the following features in the pipeline:
186+
I've failed at getting any kind of traction with StaticBackend on its closed
187+
source form. I think developer tool like these need to be open source.
105188

106-
1. ~Serverless function would enable having some backend functions directly
107-
runnable from the backend server.
108-
2. Message Queueing system (this is related to having custom function running first)
109-
3. Try to make StaticBackend as useful as possible aka listening to feedback
189+
I believe in the product, it solves a pain I have for so long, but I'm hoping
190+
others will also get value out of it and will be excited about the project.

0 commit comments

Comments
 (0)