A demo full-stack app that mocks interactions with a crypto-wallet API/store for demonstration purposes.
Project Structure
backend/— FastAPI app, DB layer, CRUD, models, routes, and tests.frontend/— React app.
Inside backend/:
crud/— high-level DB operations used by routes/services.db/— SQLAlchemy DB definitions and helpers.models/— Pydantic/ORM modelsroutes/— FastAPI route handlers.services/— business logic and external API wrapper(s).app.py— FastAPI application and route registration.
Setup
- Create and activate a Python venv and install backend deps:
python3 -m venv backend/.venv
source backend/.venv/bin/activate
pip install -r backend/requirements.txt- Start the backend:
uvicorn backend.app:app --reload --port 8000- Start the frontend:
cd frontend
npm install
npm run devUsage
- Visit
http://localhost:8000/walletsto get to show stored wallets. - Visit
http://localhost:8000/docsfor interactive API docs.
Tests
- Run tests from the project root:
pytest -q --cov --cov-branch --cov-report=htmlTest setup notes
backend/tests/conftest.py configures an in-memory SQLite database for tests using:
SQLALCHEMY_DATABASE_URL = "sqlite:///:memory:"withconnect_args={"check_same_thread": False}andpoolclass=StaticPoolso the same in-memory DB is accessible across threads/connections.- The fixture creates the schema once for the test session (
Base.metadata.create_all(bind=engine)), yields, then drops it at teardown. - The
clientfixture overrides the app'sget_dbdependency so route handlers in tests use the test session.
Deployment (Render)
-
Live:
https://crypto-wallets-frontend.onrender.com/(frontend) andhttps://crypto-wallets.onrender.com/(backend). -
Quick note: both services are hosted on Render's free tier. Free instances sleep after inactivity, so the first request after a sleep can take a long time (+/- 50 seconds) while the instance wakes. Because the frontend needs the backend, you may see failed requests until the API is awake.
