Skip to content

feat: Add database setup and schema for User and Preferences (#154)#215

Merged
Baskarayelu merged 1 commit intoRemitwise-Org:mainfrom
Miracle656:feature/issue-154-database-setup
Feb 25, 2026
Merged

feat: Add database setup and schema for User and Preferences (#154)#215
Baskarayelu merged 1 commit intoRemitwise-Org:mainfrom
Miracle656:feature/issue-154-database-setup

Conversation

@Miracle656
Copy link
Contributor

Description

Closes #154

This PR introduces the MVP database setup and schema required for user management and preference tracking in the frontend/backend that operate beyond on-chain data.

Prisma with SQLite has been selected as the initial database choice. This setup requires zero extra configuration to launch locally and can easily be swapped to a production database like PostgreSQL when necessary.

Key Changes

  • Prisma Setup: Installed prisma & @prisma/client (v5.22.0) to manage the schema and generate the database client.
  • Initial Schema: Created prisma/schema.prisma containing models:
    • User: Handles standard user details (id, stellar_address, createdAt, updatedAt).
    • UserPreference: Tied to User containing configuration choices (currency, language, notifications_enabled).
  • Database Client Singleton: Implemented lib/db.ts to instantiate a single PrismaClient globally, preventing Next.js hot-reload connection exhaustions.
  • Migration & Env Config: Added dev.db initialization steps using .env mapping and configured the first database migration step init.
  • Documentation: Updated README.md to walk developers through the correct local database setup when cloning or starting up the codebase.

Acceptance Criteria Validated

  • DB client and migrations established in the repo.
  • User and UserPreference tables created.
  • README.md documents setup clearly.

How to test this PR locally

  1. Checkout this branch: git checkout feature/issue-154-database-setup
  2. Install the new dependencies via pnpm install or npm install.
  3. Create an .env file at the project root with the following:
    ```env
    DATABASE_URL="file:./dev.db"
    ```
  4. Run the Prisma migrations: npx prisma migrate dev
  5. Verify the typechecker correctly identifies the Prisma client with npx tsc --noEmit.

@Baskarayelu
Copy link
Contributor

LGTM!

@Baskarayelu Baskarayelu merged commit ce9d138 into Remitwise-Org:main Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database Setup and Schema (User and Preferences)

2 participants