Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

27 Commits

Folders and files

Repository files navigation

Electronics Shopping

This repository contains two separate applications:

  • client/ — React frontend (TanStack Start, Vite, Bun)
  • backend/ — Rust API (Axum, SQLx, PostgreSQL)

The frontend calls the Rust API through TanStack Start server functions for catalog, account, cart, and checkout operations. Sign-in is required for cart and orders. The backend remains the source of product and order data.

Prerequisites

  • Rust (stable)
  • Docker & Docker Compose
  • Bun (for the frontend)
  • SQLx CLI: cargo install sqlx-cli --no-default-features --features postgres

Quick Start

# 1. Copy the env template and fill in your secrets
cp .env.example .env

# 2. Start the database, run migrations, and launch both servers
make dev

That's it. The API listens on http://127.0.0.1:8000 and the frontend dev server on http://localhost:3000.

Make Targets

Target Description
make db Start Postgres via Docker Compose
make db-stop Stop Postgres
make migrate Run SQLx migrations
make seed Seed the catalogue with demo products
make backend Start the Rust API
make client Start the Vite dev server
make dev Start DB + migrations + backend + client together
make test Run backend tests
make fmt Check Rust formatting
make clippy Run clippy lints
make lint Run all quality checks (fmt + clippy + tests)
make sqlx-prepare Regenerate the .sqlx offline cache (commit it!)

Manual Setup

If you prefer not to use make, run backend commands from backend/ so the API can find configuration.yaml, the SQLx offline cache, and the migrations:

docker compose up -d                  # Start Postgres
cd backend
DATABASE_URL=postgres://postgres:password@localhost:5432/electronics_shopping_api \
  cargo sqlx migrate run              # Run migrations
cargo run                             # Start the API

For the frontend:

cd client
bun install --frozen-lockfile
bun run dev

Set API_BASE_URL and SESSION_SECRET for the client server (see client/.env.example). The API must be reachable from that server. The UI displays prices as USD; checkout places a pending order without processing payment.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages