Skip to content

[Feature]: Project & Milestone Schema Design #32

@SudiptaPaul-31

Description

@SudiptaPaul-31

🔍 Problem Statement

📖 Description

Design a robust PostgreSQL schema to support core entities of the freelance platform. The schema should cover users, projects, milestones, contracts, and disputes, with indexing strategies for efficient queries.

Expected Behavior

  • Users: Store freelancer and client profiles with wallet addresses, authentication details, and role distinctions.
  • Projects: Represent client-created projects with metadata (title, description, budget, deadlines).
  • Milestones: Track project milestones with title, description, amount, due date, and status.
  • Contracts: Link freelancers to projects, including terms, escrow details, and status.
  • Disputes: Record disputes raised by clients or freelancers, with reason, evidence, and resolution status.

🛠 Technical Notes

  • Schema Design:

    • Normalize tables to avoid redundancy.
    • Use foreign keys to enforce relationships (e.g., milestones → projects, contracts → users/projects).
    • Include timestamps (created_at, updated_at) for auditing.
  • Indexing Strategy:

    • Index wallet addresses for fast authentication lookups.
    • Index project IDs and milestone IDs for efficient joins.
    • Consider composite indexes for queries involving user + project or project + milestone.
    • Use partial indexes for filtering active vs. completed contracts.
  • Scalability Considerations:

    • Support pagination for large contract/milestone histories.
    • Optimize queries for dashboard views (freelancer and client).
    • Ensure schema supports future extensions (e.g., ratings, reviews, notifications).

✅ Acceptance Criteria

  • Schema includes tables for users, projects, milestones, contracts, and disputes.
  • Relationships are correctly defined with foreign keys.
  • Indexes are applied to critical query paths (wallet, project, milestone, contract).
  • Schema passes migration tests and integrates with backend APIs.
  • npm run lint and npm run build succeed.
  • No regression in authentication, wallet connection, or dashboard features.

📈 Expected Impact

High — Would significantly improve user experience

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions