A modern REST API backend built with Rust, Axum web framework, and SQLite database. (Vibe coded)
dist/
directorycargo build
Start the development server:
cargo run
The server will start on http://localhost:3000
/api/hello
Returns a greeting message.
Response:
{
"message": "Hello from Axum backend with SQLite!"
}
/api/users
Retrieves all users from the database.
Response:
[
{
"id": 1,
"name": "Prop"
},
{
"id": 2,
"name": "Bob"
}
]
/api/users
Creates a new user.
Request Body:
{
"name": "John Doe"
}
Response:
{
"id": 3,
"name": "John Doe"
}
src/
โโโ main.rs # Application entry point and server setup
โโโ database.rs # Database initialization and connection
โโโ handlers.rs # Route handlers and business logic
โโโ models.rs # Data structures and schemas
โโโ routes.rs # Route definitions and configuration
The application uses SQLite with the following schema:
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL
);
The database file (users.db
) is automatically created on first run with initial seed data.
http://localhost:5173
(Vite dev server)GET
, POST
Content-Type
0.0.0.0
3000
cargo build
cargo run
cargo check
The application is configured for development with:
This project is part of a learning/playground repository.