This project is built using the T3 stack, which includes Next.js, TypeScript, Tailwind CSS, tRPC, and Prisma.
- Clone the repository
- Install dependencies:
pnpm install
- Set up your environment variables in
.env
by copying the.env.example
file and filling in the missing values - Setup the database:
pnpm run db:push
- Run the development server:
pnpm run dev
- Open http://localhost:3000 in your browser
- Open http://localhost:5555 in your browser to view the Prisma database studio
root/
├── prisma/
│ ├── schema.prisma # Database schema
├── src/
│ ├── components/
│ │ ├── cases/
│ │ │ ├── CreateCase.tsx # Form component to create a Case
│ │ │ ├── CaseList.tsx # Component to list all Cases
│ │ ├── ui/ # Shared UI components with Shadcn
│ ├── pages/
│ │ ├── index.tsx # The main page of the application
│ ├── server/
│ │ ├── api/
│ │ │ ├── cases/
│ │ │ │ ├── case.ts # Backend procedures for creating a Case
│ │ │ │ ├── task.ts # Backend procedures for managing long-running tasks
│ │ ├── inngest/
│ │ │ ├── client.ts # Familiarity is not required - mocks a long-running background task
├── .env.example # Initial environment variables
├── package.json
├── README.md
- Next.js
- TypeScript
- Tailwind CSS
- tRPC - Typesafe backend for NextJS
- Tanstack Query - Data fetching (within tRPC wrapper)
- Zod - Validation
- Shadcn UI - Used for basic components
- Prisma - Using SQLite for the database
- Inngest - This is used to mock a long-running background job, familiarity is not required for the challenge
You'll be able to run the app and interact with the database using the following commands:
# Development
npm dev # Start the development server, with the app on port 3000 and the database studio on 5555
# Managing the database
npm db:push # Push the database schema to the database
For more information on the T3 stack, visit create.t3.gg.
You’ve been given an an application for a Legal Case Platform that allows a lawyer to create and manage their Cases
with their clients.
The application is a sandbox with basic features implemented, it can be changed and critiqued as necessary.
(You don't need to worry about authentication or permissions. You can assume there will only be a single user of the application.)
A Case
describes a piece of legal work a lawyer is helping their client with.
A Case
has a Payment Type
which describes how the lawyer will be paid for their work.
There are two types of Payment Type
:
- Fixed Fee: A fixed amount is paid for the case
- No Win No Fee: A percentage of future compensation is paid for the case (if successful), e.g. "20% of any compensation"
Lawyers can create Cases
on the platform, and they specify the Payment Type
for each Case
.
Lawyers will collect payment from clients, and mark their Case
as Paid
.
When a case is paid
, lawyers will also pay a fee
to the platform for facilitating the case.
Depending on the Payment Type
of a Case, the fee paid to the platform changes:
- Fixed Fee Cases are charged a 20% fee of the payment amount
- No Win No Fee Cases are charged a 40% fee of the payment amount
A Case
has a Title
, Description
, Status
, a Payment Type
and payment information depending on the Payment Type
.