Flarebase is a lightweight Backend-as-a-Service (BaaS) solution built with Python and powered by the FastHTML Framework. It is designed to offer a simple user interface for managing your database with REST APIs for both tables and records.
- Overview
- Features
- Getting Started
- Project Structure
- API Endpoints
- User Interface
- Contributing
- Additional Documentation
Flarebase provides:
- A simple UI for database management.
- REST APIs that support creating, updating, and deleting tables and records.
- A flexible backend powered by FastHTML and TinyDB.
- Simple UI: Easily navigate tables, view records, and perform CRUD operations.
- Fast Setup: Minimal configuration is required.
- Extensible: Built with Python; easily extend functionality.
- RESTful Endpoints: Interact with your database programmatically.
- Python 3.7 or higher
pip
package manager
-
Clone the Repository
git clone https://github.com/Anas099X/FlareBase.git cd flarebase
-
Install Required Modules
pip install -r requirements.txt
-
Run the Application
python main.py
-
Access the UI
Open your browser and navigate to http://localhost:5001.
For more details, refer to the README.md.
├── __pycache__/
├── .gitignore
├── .sesskey
├── docs/
│ ├── records.md
│ └── tables.md
├── flarebase.json
├── main.py
├── README.md
├── requirements.txt
├── routes/
│ ├── __pycache__/
│ └── REST.py
└── test.py
- main.py: Application setup, UI routes, and helper functions.
- routes/REST.py: REST API endpoints for tables and records.
- docs/records.md: Documentation related to records.
- docs/tables.md: Documentation related to tables.
-
Get All Tables
Endpoint:
GET /api/tables
Description: Returns a JSON list of all table names.
-
Get Table Content
Endpoint:
GET /api/tables/{table}
Description: Returns all documents (records) from the specified table.
-
Create Table
Endpoint:
POST /api/tables/create?name=table_name&fields=field1,field2,...
Description: Creates a new table with the specified name and fields.
-
Delete Table
Endpoint:
DELETE /api/tables/{table}
Description: Drops the specified table from the database.
-
Search Table
Endpoint:
GET /api/tables/search/{table}/{field}/{input}
Description: Searches for records in the specified table where the field matches the input.
For more details, you can review the implementation in routes/REST.py.
-
Create Record
Endpoint:
POST /api/record/create?table={table_name}&record={record_data}
Description: Inserts a new record into the specified table.
-
Delete Record
Endpoint:
DELETE /api/record/delete?table={table_name}&record-id={id}
Description: Removes a single record identified by its document ID.
See the record documentation in docs/records.md and the REST implementation in routes/REST.py.
The web interface is served via the root route (/
) from main.py. It provides:
- A dashboard listing all tables as clickable cards.
- A dynamic drawer for adding new tables and records.
- Interactive elements (using HTMX) to perform actions like updating or deleting records.
The UI also includes additional endpoints such as /view_table/{selected_table}
to view and manage records in a specific table.
If you'd like to contribute:
- Fork the repository.
- Create a new branch (e.g.,
git checkout -b feature/YourFeatureName
). - Commit your changes.
- Push to your branch.
- Open a pull request.
Follow guidelines in the README.md.
- Records Documentation: docs/records.md
- Tables Documentation: docs/tables.md
Happy coding with Flarebase!