To install and run the Swimtimes application, follow these steps:
- Install Docker, Node, and the Rust compiler.
- Create a
secrets.toml
file for Shuttle deployment with the following content:
DATABASE_URL='mysql://root:1337@localhost:3306/swimdb'
RUST_LOG="info,sqlx=off,async_graphql=warn,api=info"
local_uri="postgres://postgres:postgres@localhost:5432/swimdb"
JWT_SECRET=
- Install the
cargo-shuttle
tool by running:
cargo install cargo-shuttle
-
Setup a project on Shuttle-rs
-
Setup Supabase or any other JWT/JWK provider
-
in
/swimtimes/app/app.config.ts
set the config
const config = {
apiUrl: process.env.NODE_ENV === 'development' ? 'http://localhost:8000' : 'https://<url>.shuttleapp.rs',
authClientUrl: "https://<id>.supabase.co",
anonKey: "<anonkey>"
};
export default config;
- Start the container using Docker Compose:
docker-compose up -d
- Run the application with:
cargo shuttle run
Field | Type | Description |
---|---|---|
id | i32 | Primary Key |
name | String | Swimmer's name |
date_of_birth | Date | Swimmer's date of birth |
team | i32 (FK) | Foreign key to Team |
Field | Type | Description |
---|---|---|
id | i32 | Primary Key |
name | String | Team's name |
founding_date | Date | Team's founding date |
address | String | Team's address |
zip_code | String | Team's zip code |
Field | Type | Description |
---|---|---|
id | i32 | Primary Key |
competition | i32 (FK) | Foreign key to Competition |
distance | i32 | Swim distance in meters |
stroke | String | Swim stroke type |
time | i32 | Swim time in seconds |
swimmer | i32 (FK) | Foreign key to Swimmer |
- Docker
- Node.js
- React
- Vite
- Rust
- Axum
- SQLx/Sea ORM
- GraphQL (async-graphql)
- Postgresql
- Supabase
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── Secrets.toml
├── Shuttle.toml (use this instead of .env)
├── api (API library for Axum server)
├── app (React app)
├── docker-compose.yml
├── entities.sh (Migration command, creates entity files)
├── entity (Contains all models/entities for the project)
├── example.env
├── migration (Sea ORM migrations)
├── repository (manages commands to DB)
├── src (main crate, spins up web server from API using Shuttle-rs)
├── static (output directory for building react app. Will be served by API)
├── target
└── tests