Skip to content

Commit 7c14fa2

Browse files
authored
Version 0.5
1 parent ae77029 commit 7c14fa2

File tree

18 files changed

+693
-0
lines changed

18 files changed

+693
-0
lines changed

docs/Banner.png

532 KB
Loading

docs/README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<p align="center"><img alt="clorabase" height="300" src="/Banner.png"></p>
2+
<p align="center">
3+
<img src="https://img.shields.io/github/license/ErrorxCode/Clorabase?style=for-the-badge">
4+
<img src="https://img.shields.io/github/stars/ErrorxCode/Clorabase?style=for-the-badge">
5+
<img src="https://img.shields.io/github/issues/ErrorxCode/Clorabase?color=red&style=for-the-badge">
6+
<img src="https://img.shields.io/github/forks/ErrorxCode/Clorabase?color=teal&style=for-the-badge">
7+
</p>
8+
9+
<p align="center">
10+
<img src="https://img.shields.io/badge/Author-Rahil--Khan-cyan?style=flat-square">
11+
<img src="https://img.shields.io/badge/Open%20Source-Yes-cyan?style=flat-square">
12+
<img src="https://img.shields.io/badge/Written%20In-Java-cyan?style=flat-square">
13+
<img src="https://jitpack.io/v/Clorabase/Clorabase.svg">
14+
</p>
15+
16+
17+
## Clorabase
18+
> *Turn your github repo into a No-SQL database*
19+
20+
Clorabase is a free backend alternative (BaaS) for Android and java apps that uses GitHub API & Github repo to facilitate NoSQL database & NTFS like storage system. Clorabase is mostly made for small apps which has small backend/server/database requirements. If your app scales large or you need more database storage or bandwidth, Clorabase may not serve you. You should consider using [Firebase](https://firebase.google.com). Clorabase AIMS provides a money-free production-ready backend for building Android apps as a hobby or start-up. It is for those who don't earn money from their apps and build apps just for learning or non-profit use.
21+
22+
<a href="https://github.com/Clorabase/Clorabase/releases/download/0.5/Console-stable-v0.5.apk"> <img alt="Download console" height=40 src="/button.png"></a>
23+
24+
## Features
25+
- No account needed
26+
- Uses GitHub usage & quota
27+
- Absolutely Free, No paid plans
28+
- Serverless NO-SQL database
29+
- In-app messaging
30+
- In-app updates
31+
- Cloud storage for apps
32+
33+
34+
## Implementation
35+
#### To add SDK
36+
In your project **build.gradle**
37+
```
38+
allprojects {
39+
repositories {
40+
...
41+
maven { url 'https://jitpack.io' }
42+
}
43+
}
44+
```
45+
In module **build.gradle** inside **dependencies** block:
46+
- For Android SDK:
47+
```
48+
implementation 'com.github.Clorabase.Clorabase:SDK:0.5'
49+
```
50+
- For Java SDK:
51+
```
52+
implementation 'com.github.Clorabase.Clorabase:Clorabase4j:0.5'
53+
```
54+
55+
56+
57+
#### To generate a GitHub OAuth token
58+
1. Goto [Create token](https://github.com/settings/tokens/new)
59+
2. Select the 'Classic' token type and set the expiry to 'No expiration'
60+
3. Check the following in the scope sections:
61+
- delete_repo
62+
- repo
63+
4. Click generate.
64+
65+
Now you can use this token to access the console and SDK.
66+
67+
⚠️**NOTE:** Never publish your code containing this token on GitHub, if you do, then the token will automatically be deleted and your code will break
68+
69+
70+
### Documentation
71+
- [User guide](https://clorabase.github.io)
72+
73+
## Clorabase vs Firebase
74+
The rule of thumb is, if you’re building a small project or dedicated mobile application, and you don’t mind the high bandwidth or database storage, Clorabase is a great place to start. If you’re looking for a more general-purpose data solution, value performance at scale and advanced querying, Firebase is going to serve your needs best.
75+
76+
See the table below to compare Clorabase and Firebase with their features.
77+
78+
| Feature | Clorabase | Firebase |
79+
| :--- | :--- | :--- |
80+
| **Primary Use Case** | Small, non-commercial Android apps, hobby projects, proof-of-concepts, learning. | Professional, scalable, and cross-platform applications (mobile & web). |
81+
| **Cost** | **Absolutely free, no paid plans or usage barriers.** | **Freemium model:** Generous free tier, but a "pay-as-you-go" plan for high usage. |
82+
| **Backend Storage** | Your data is stored in your own **GitHub repository** | Data is stored on **Google's cloud infrastructure** (Firestore, Realtime Database, Cloud Storage). |
83+
| **Scalability** | **Limited.** Best for small-scale applications. It may not perform well with large amounts of traffic or data. | **Highly Scalable.** Built to handle millions of concurrent connections and terabytes of data. |
84+
| **Core Services** | Databases (NoSQL), Cloud Storage, Push Messaging, In-App Messaging, In-App Updates. | Databases (Firestore, Realtime DB), Authentication, Cloud Functions, Hosting, Machine Learning, Analytics, Push Notifications, and more. |
85+
86+
87+
#### Choose Clorabase when...
88+
- Your primary concern is **cost**, and you need a completely free solution.
89+
90+
- You are building a personal or hobby project that won't have a large user base.
91+
92+
- The app is an Android or Java only project.
93+
94+
- You have a simple data model and don't require advanced queries, authentication, or other integrated services.
95+
96+
- You are comfortable with a more hands-on, DIY approach and are willing to handle things like user authentication yourself.
97+
98+
99+
100+
## Contributing to Clorabase
101+
First off, thank you for considering contributing to Clorabase! It's because of people like you that this project can be what it is today.
102+
103+
We welcome all types of contributions, from reporting bugs and suggesting new features to writing code and improving documentation.
104+
105+
Refer to [contribution.md](/contribution.md) to start contributing
106+
107+
*-> For personal assitance, you can contact the repo owner at [email protected] or [x1.rahil](https://instagram.com/x1.rahil) on instagram*
108+
109+
110+
111+
## Support
112+
This project comprises of lot's of energy, brainstorming, coding, testing and time. If this project has helped you in any way, please consider giving it a ⭐ to show your support and help it grow! Also, *watch* the repo to notify about updates.
113+
114+
[![Readme Quotes](https://quotes-github-readme.vercel.app/api?type=horizontal&theme=dracula)](https://github.com/piyushsuthar/github-readme-quotes)
115+
116+
117+
![water](https://raw.githubusercontent.com/mayhemantt/mayhemantt/Update/svg/Bottom.svg)

docs/button.png

4.4 KB
Loading

docs/cover.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
![logo](favicon.png)
2+
3+
# Clorabase<small>0.5 (Preview)</small>
4+
5+
> Turn your GitHub into a No-SQL database
6+
7+
- Simple and lightweight
8+
- Easy, manageable and accessible
9+
- Uses GitHub API
10+
- Always free
11+
12+
[Website](https://clorabase.netlify.app)
13+
[Get Started](#clorabase)
14+

docs/favicon.png

14.4 KB
Loading

docs/index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Clorabase documentation</title>
6+
<link rel="icon" href="favicon.png" />
7+
<meta name="keywords" content="clorabase, android backend, firebase alternative, clorastoreDB, github as backend, supabase alternative, nosql database, mongoDB alternative, firestore alternative"/>
8+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
9+
<meta name="description" content="Clorabase is a free % open source backend (BaaS) alternative for Android/Java apps. Turn your GitHub repo into a NoSQL database and cloud storage for your app. Use database, storage, in-app messages, in-app updates and lot more">
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
11+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
12+
</head>
13+
<body>
14+
<div id="app"></div>
15+
<script>
16+
window.$docsify = {
17+
name: 'Clorabase',
18+
repo: 'https://github.com/Clorabase/Clorabase',
19+
coverpage: 'cover.md',
20+
loadSidebar: 'toc.md'
21+
}
22+
</script>
23+
<!-- Docsify v4 -->
24+
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
25+
</body>
26+
</html>

docs/pages/database.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Clorabase Database
2+
3+
Clorabase Database is an open-source, flexible, serverless database for Android & Java apps built on top of [ClorastoreDB](https://github.com/Clorabase/ClorastoreDB) that uses GitHub API to facilitate your online database. It has a dedicated SDK for Android apps written on top of a Java library. The SDK uses Google's Tasks API as a wrapper of a Java library, which helps you to write async code.
4+
5+
## Key features
6+
7+
* No extra account is needed
8+
* Simple & easy SDK
9+
* NO-SQL databases
10+
* Can be managed using the console and Github web UI
11+
12+
13+
14+
## Usage / Examples
15+
16+
This database is implemented from the [ClorastoreDB](https://github.com/Clorabase/ClorastoreDB) offline version. See its docs to understand the pattern of the database.
17+
Refer to the [Wikipedia article](https://en.wikipedia.org/wiki/Document-oriented_database) to learn more about this.
18+
19+
20+
### Get the root collection of the database
21+
22+
```java
23+
Clorabase clorabase = Clorabase.getInstance(GITHUB_USERNAME,GITHUB_TOKEN, PROJECT_NAME);
24+
Collection root = clorabase.getDatabase();
25+
```
26+
27+
28+
To get your Oauth token, check the [Implementation](https://github.com/ErrorxCode/docs/edit/main/clorabase/README.md#implementation) part of the README
29+
30+
31+
?> **In Android SDK:** Every method has its `async` version and `non-async` version. All the async methods end with `async` and return `async`. Implementation of the class.
32+
?> **In the Java library:** There are only sync functions with the same name
33+
34+
### Writing/Updating data
35+
36+
Let's insert a new user into `users` collection :
37+
38+
```java
39+
Map data = new HashMap<>();
40+
data.put("name","John");
41+
data.put("age",25);
42+
data.put("is_married",false);
43+
44+
root.collection("users").documentAsync("user1").setDataAsync(data)
45+
.addOnSuccessListener(unused -> System.out.println("Success"))
46+
.addOnFailureListener(e -> System.out.println("Failed"));
47+
```
48+
49+
50+
If the `user1` document already exists in that collection, **then it will update its fields.**
51+
52+
?> **Tip**
53+
\>Every database operation method returns a `Task` . See tasks [documentation](https://developers.google.com/android/guides/tasks) for more info.
54+
55+
The structure created will be like this,
56+
57+
![image](https://user-images.githubusercontent.com/65817230/230773260-1a207a69-03e6-4c3a-9fca-d4f0bba305c3.png)
58+
59+
60+
You can also have a collection inside a collection, but not a collection or document inside a document.
61+
62+
63+
### Reading data
64+
65+
To read data from the database, use `getDataAsync()` method on the **document** where it was inserted.
66+
67+
```java
68+
root.collection("users").documentAsync("user1").getDataAsync()
69+
.addOnSuccessListener(System.out::println)
70+
.addOnFailureListener(Throwable::printStackTrace);
71+
```
72+
73+
74+
75+
### Deleting data
76+
77+
To delete a document or collection, go to its parent collection and call `delete()method. To delete a field in a node, just put its value to null`
78+
79+
```java
80+
root.collection("users").deleteAsync("user1")
81+
.addOnSuccessListener(System.out::println)
82+
.addOnFailureListener(Throwable::printStackTrace);
83+
```
84+
85+
86+
87+
88+
### Querying data
89+
90+
Querying data in **ClorastoreDB** is as easy as pie. You just have to pass a `Predicate as a condition for querying data. The database will include every document for which the Predicate` return true.
91+
92+
Suppose if your structure is like this (\*JSON representation of collection & it's document, where `users is the collection and each user` object is it's document\*):
93+
94+
```json
95+
{
96+
"users": [
97+
"user1": {
98+
"name": "John",
99+
"age": 30,
100+
"is_married": false
101+
},
102+
"user2": {
103+
"name": "Mary",
104+
"age": 25,
105+
"is_married": true
106+
},
107+
"user3": {
108+
"name": "Mike",
109+
"age": 27,
110+
"is_married": false
111+
}
112+
]
113+
}
114+
```
115+
116+
117+
118+
* To get all the users whose age is greater than 18,
119+
120+
```java
121+
root.collection("users").query().whereGreater("age",18)
122+
```
123+
124+
125+
126+
* To get users whose name start's with 'a'
127+
128+
```java
129+
db.collection("users").query().where(data -> data.get("name").toString().startsWith("a"));
130+
```
131+
132+
133+
**Note**: You need to manually check for the `return value of data.get("age")` , as it could be null if some document does not contain that value.
134+
135+
* To order data by a particular field (Ascending order)
136+
137+
```jva
138+
root.collection("users").query().orderBy("age",20);
139+
```
140+
141+
142+
143+
144+
_That's all that you need to know about the database._
145+
146+
147+
148+
149+
150+
151+
152+
153+
154+
155+

docs/pages/github.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Managing project/app
2+
3+
4+
The main feature of clorabase is that it turns your GitHub repo into an application database. Since all the data is stored within your repo contents, you can also manage it using the GitHub Web UI, just like you do for your other projects on GitHub. However, due to a custom protocol & specification that clorabase uses inside, you cannot do everything from the GitHub UI that you can do from the console app.
5+
6+
7+
## What things can you do using GitHub UI
8+
9+
* Upload a small file to storage
10+
* Insert/Send an in-app message to the queue
11+
* Create a versioned app update
12+
* Delete database documents/collection
13+
* Delete storage files
14+
* Delete project
15+
* Edit in-app messages/updates
16+
* Edit or change project configurations
17+
18+
19+
20+
### Uploading a file into storage
21+
22+
To upload a file to your project storage, you can directly go to the project storage directory and upload a file there.
23+
The project storage directory can be found inside your project folder from the root of the "Clorabase-database" repo.
24+
Eg. `foobar/storage/user1/photos` --> Upload a file here
25+
26+
27+
### Send in-app message
28+
29+
To send an in-app message, just create/upload a JSON file that contains the message spec, with a random name, into the project's messaging directory, i.e `project/messages`
30+
31+
**Example message.json:**
32+
33+
```json
34+
{
35+
"title": "Demo title",
36+
"message": "Demo message...",
37+
"link": "https://errorxcode.github.io/clorabase",
38+
"type": "simple"
39+
}
40+
```
41+
42+
43+
**Note: All the fields are mandatory**
44+
45+
46+
### Create a versioned app
47+
48+
All the updates related information is created and managed in the update directory of your project. In this directory, there are folders with the package name of your Android application, which then contain the information about the current version of the app.
49+
50+
To add a versioned application to your project, just create a `versions.json` inside your app package folder, in the project's updates directory, i.e `project/updates/com.foo.bar`
51+
52+
**Example versions.json:**
53+
54+
```json
55+
{
56+
"code": 5,
57+
"name": "4dgg",
58+
"package": "clorabase.sample.app",
59+
"downloadUrl": "https://google.com",
60+
"downloadCount": 0,
61+
"mode": "flexible",
62+
"date": "12-09-2025"
63+
}
64+
```
65+
66+
67+
68+
69+
70+
### Deleting document/file/message or anything:
71+
72+
Deleting is very easy; you just need to delete the respective files from the respective directory. For example, you can delete any document from the database, any message from the message queue or any files from the storage. _There's nothing much you have to take care of while deleting_
73+
74+
75+
76+
> _That's all, Thank you for paying attention to the docs :)_

0 commit comments

Comments
 (0)