A Pocketbase alternative (or copy) written in C and using Mongoose web server and SQLite
!!! This is probably never going to be a production grade application !!!
!!! Expect crash, segfault and many other problems while using the app !!!
- SQLite DB
- Authentication
- Embedded admin UI
- Less than 5MB single executable (might exceed a bit in the future)
Windows and Linux are currently the only supported platforms !
C_Base does not and will not provide any SDK.
But you can query the API through any HTTP client.
Just run the C_Base.exe.
C_Base will create several folders :
cb_data
: store the SQLite DB, files and logscb_public
: serve static files (e.g.: the website that will consume the API)cb_hooks
: contains the custom JS logics (not implemented yet)
The default port is 0.0.0.0:8080
but you can change it with the --host
or -p
program argument
You can then access :
localhost:8080/
:cb_public
contentlocalhost:8080/_/
: admin UIlocalhost:8080/api
: API
The default admins credentials are username: admin password: admin
Change it as soon as you log into the app for the first time.
URL | HTTP Verb | Description | Expected Body |
---|---|---|---|
/api/auth/login" |
POST | User login | {username:string, password:string} |
/api/auth/register |
POST | User registration | {username:string, password:string} |
/api/tables |
GET | List available tables except the C_Base ones | |
/api/table/:table?where=... |
GET | Get the table rows according to the optional where clause | |
/api/version |
GET | Return the current version of the C_Base instance |
URL | HTTP Verb | Description | Expected Body |
---|---|---|---|
/api/admin/login |
POST | Admin login | {username:string, password:string} |
/api/admin/logs |
GET | Get the C_Base instace logs | |
/api/admin/query |
POST | Query the database | {query: string} |
/api/admin/admins |
GET | List all the existing admins | |
/api/admin/admin |
POST | Create a new admin | {username:string, password:string} |
/api/admin/admin/:adminId |
DELETE | Delete the admin by id | |
/api/admin/table/:tableName |
POST | Create a new table | |
/api/admin/table/:tableName |
DELETE | Delete the table by tableName | |
/api/admin/configs |
GET | Get all the C_Base configuration | |
/api/admin/configs |
PUT | Set the C_Base configuration | {name:string, value:string} |
The final goal is to implements as many features Pocketbase offers.
- Single executable
- SQLite through HTTP (Basic CRUD)
- Authentication (only SHA256 encryption for now)
- API Rules
- Real time change through websocket
- JS engine to add custom behavior (probably gonna use Duktape Engine)
C_Base is just a little personal challenge so I can learn a bit of C (that's why it's probably full of memory leaks).
Feel free to open an issue or start a discussion if you have any questions or improvement suggestions
Next items I will work on :
- Create table from Admin UI
- Config table for Admins
- Where clause from API
- Prevent access to password and salt from user table (didn't find elegant way to do it yet)