Initial commit

This commit is contained in:
gamvo74 2026-02-22 02:27:05 -05:00
commit 1a92f4afa0
27 changed files with 3167 additions and 0 deletions

23
.env Normal file
View File

@ -0,0 +1,23 @@
# Database
POSTGRES_USER=myuser
POSTGRES_PASSWORD=mypassword
POSTGRES_DB=pro_se_litigant
# API Configuration
PORT=4000
CORS_ORIGIN=https://app.proselitigant.com
NODE_ENV=production
# Rate Limiting
THROTTLE_TTL=60
THROTTLE_LIMIT=100
# Stripe (if applicable)
STRIPE_API_KEY=your_stripe_key
STRIPE_WEBHOOK_SECRET=your_webhook_secret
# OpenAI (if applicable)
OPENAI_API_KEY=your_openai_key
# JWT
JWT_SECRET=super-secret-development-key-change-me

24
.env.example Normal file
View File

@ -0,0 +1,24 @@
# Database
POSTGRES_USER=myuser
POSTGRES_PASSWORD=mypassword
POSTGRES_DB=pro_se_litigant
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?schema=public
# API Configuration
PORT=4000
CORS_ORIGIN=https://app.proselitigant.com
NODE_ENV=production
# Rate Limiting
THROTTLE_TTL=60
THROTTLE_LIMIT=100
# Stripe (if applicable)
STRIPE_API_KEY=your_stripe_key
STRIPE_WEBHOOK_SECRET=your_webhook_secret
# OpenAI (if applicable)
OPENAI_API_KEY=your_openai_key
# JWT
JWT_SECRET=your_jwt_secret_change_me

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# pro-se-litigant
Pro Se Litigant Respository

41
apps/web/.gitignore vendored Normal file
View File

@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

38
apps/web/Dockerfile Normal file
View File

@ -0,0 +1,38 @@
# Stage 1: Build
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build the Next.js application
RUN npm run build
# Stage 2: Production
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Copy necessary files from builder
COPY --from=builder /app/next.config.ts ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
# Create a non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
EXPOSE 3000
CMD ["npm", "start"]

36
apps/web/README.md Normal file
View File

@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

BIN
apps/web/app/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

26
apps/web/app/globals.css Normal file
View File

@ -0,0 +1,26 @@
@import "tailwindcss";
:root {
--background: #ffffff;
--foreground: #171717;
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}
body {
background: var(--background);
color: var(--foreground);
font-family: Arial, Helvetica, sans-serif;
}

34
apps/web/app/layout.tsx Normal file
View File

@ -0,0 +1,34 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
);
}

23
apps/web/app/page.tsx Normal file
View File

@ -0,0 +1,23 @@
import Image from "next/image";
export default function Home() {
return (
<div className="flex flex-col items-center justify-center min-h-screen text-center bg-gray-50">
<Image
src="/logo.png"
alt="Pro Se Litigant Logo"
width={180}
height={180}
priority
/>
<h1 className="text-4xl font-bold mt-6">
Pro Se Litigant
</h1>
<p className="mt-4 text-gray-600 max-w-xl">
Your AI Legal Partner for Smarter Drafting, Research, and Case Preparation.
</p>
</div>
);
}

View File

@ -0,0 +1,29 @@
"use client";
import Image from "next/image";
import Link from "next/link";
export default function Navbar() {
return (
<nav className="flex items-center justify-between px-6 py-3 border-b bg-white shadow-sm">
<Link href="/dashboard" className="flex items-center space-x-3">
<Image
src="/logo.png"
alt="Pro Se Litigant Logo"
width={60}
height={60}
priority
/>
<span className="text-xl font-semibold">
Pro Se Litigant
</span>
</Link>
<div className="space-x-4">
<Link href="/matters">Matters</Link>
<Link href="/research">Research</Link>
<Link href="/transcribe">Transcribe</Link>
</div>
</nav>
);
}

View File

@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);
export default eslintConfig;

7
apps/web/next.config.ts Normal file
View File

@ -0,0 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
};
export default nextConfig;

2582
apps/web/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

26
apps/web/package.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "pro_se_litigant",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"next": "16.1.6",
"react": "19.2.3",
"react-dom": "19.2.3"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^10.0.0",
"eslint-config-next": "^0.2.4",
"tailwindcss": "^4",
"typescript": "^5"
}
}

View File

@ -0,0 +1,7 @@
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default config;

BIN
apps/web/public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 KiB

BIN
apps/web/public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 KiB

34
apps/web/tsconfig.json Normal file
View File

@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts",
"**/*.mts"
],
"exclude": ["node_modules"]
}

60
docker-compose.yml Normal file
View File

@ -0,0 +1,60 @@
services:
db:
image: postgres:16-alpine
restart: always
environment:
POSTGRES_DB: pro_se_litigant
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d pro_se_litigant"]
interval: 10s
timeout: 5s
retries: 5
api:
build:
context: ./apps/api
dockerfile: Dockerfile
restart: always
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/pro_se_litigant?schema=public
PORT: 4000
CORS_ORIGIN: ${CORS_ORIGIN}
THROTTLE_TTL: 60
THROTTLE_LIMIT: 100
NODE_ENV: production
JWT_SECRET: ${JWT_SECRET}
expose:
- 4000
web:
build:
context: ./apps/web
dockerfile: Dockerfile
restart: always
environment:
NEXT_PUBLIC_API_URL: https://api.proselitigant.com # Replace with your domain
NODE_ENV: production
expose:
- 3000
nginx:
image: nginx:stable-alpine
restart: always
ports:
- "80:80"
- "8080:8080"
volumes:
- ./infrastructure/nginx/conf.d:/etc/nginx/conf.d
depends_on:
- api
- web
volumes:
postgres_data:

View File

@ -0,0 +1,39 @@
{
"family": "pro-se-litigant-api",
"networkMode": "awsvpc",
"containerDefinitions": [
{
"name": "api",
"image": "REPLACE_WITH_IMAGE",
"cpu": 256,
"memory": 512,
"portMappings": [
{
"containerPort": 4000,
"hostPort": 4000,
"protocol": "tcp"
}
],
"essential": true,
"environment": [
{
"name": "NODE_ENV",
"value": "production"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/pro-se-litigant-api",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
}
}
],
"requiresCompatibilities": [
"FARGATE"
],
"cpu": "256",
"memory": "512"
}

View File

@ -0,0 +1,22 @@
server {
listen 80;
server_name api.proselitigant.com localhost;
# Security headers
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
location / {
proxy_pass http://api:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Request-Id $request_id;
}
}

View File

@ -0,0 +1,22 @@
server {
listen 8080;
server_name app.proselitigant.com localhost;
# Security headers
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
location / {
proxy_pass http://web:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Request-Id $request_id;
}
}

View File

@ -0,0 +1,8 @@
{
"name": "pro-se-litigant",
"private": true,
"workspaces": [
"apps/*",
"packages/*"
]
}

View File

@ -0,0 +1,28 @@
# Configuration
$REGION = "us-east-1"
$PROJECT_NAME = "pro-se-litigant"
$CLUSTER_NAME = "${PROJECT_NAME}-cluster"
$REPO_NAME = "${PROJECT_NAME}-api"
Write-Host "STARTING: AWS Infrastructure Setup for $PROJECT_NAME..." -ForegroundColor Cyan
# 1. Create ECR Repository
Write-Host "TASK 1: Creating ECR Repository..." -ForegroundColor Yellow
aws ecr create-repository --repository-name $REPO_NAME --region $REGION
# 2. Create ECS Cluster
Write-Host "TASK 2: Creating ECS Cluster..." -ForegroundColor Yellow
aws ecs create-cluster --cluster-name $CLUSTER_NAME --region $REGION
# 3. Create Log Group
Write-Host "TASK 3: Creating CloudWatch Log Group..." -ForegroundColor Yellow
aws logs create-log-group --log-group-name "/ecs/$PROJECT_NAME-api" --region $REGION
# 4. Register Task Definition
Write-Host "TASK 4: Registering Task Definition..." -ForegroundColor Yellow
aws ecs register-task-definition --cli-input-json file://infrastructure/ecs/task-definition.json --region $REGION
Write-Host "SUCCESS: Basic infrastructure components (ECR, ECS Cluster, Logs) are ready!" -ForegroundColor Green
Write-Host "Next steps: "
Write-Host "1. Configure your GitHub Secrets (AWS_ACCESS_KEY_ID, etc.)."
Write-Host "2. Push your code to the 'main' branch to trigger the deployment."

View File

@ -0,0 +1,36 @@
#!/bin/bash
# Configuration
REGION="us-east-1"
PROJECT_NAME="pro-se-litigant"
CLUSTER_NAME="${PROJECT_NAME}-cluster"
SERVICE_NAME="${PROJECT_NAME}-service"
REPO_NAME="${PROJECT_NAME}-api"
echo "🚀 Starting AWS Infrastructure Setup for $PROJECT_NAME..."
# 1. Create ECR Repository
echo "📦 Creating ECR Repository..."
aws ecr create-repository --repository-name $REPO_NAME --region $REGION || echo "Repository already exists."
# 2. Create ECS Cluster
echo "🏗️ Creating ECS Cluster..."
aws ecs create-cluster --cluster-name $CLUSTER_NAME --region $REGION || echo "Cluster already exists."
# 3. Create Log Group
echo "📝 Creating CloudWatch Log Group..."
aws logs create-log-group --log-group-name "/ecs/$PROJECT_NAME-api" --region $REGION || echo "Log group already exists."
# 4. Register Task Definition
echo "📜 Registering Task Definition..."
aws ecs register-task-definition --cli-input-json file://infrastructure/ecs/task-definition.json --region $REGION
# 5. Create Load Balancer (Simplified)
echo "🌐 Note: Load Balancer, VPC, and Subnets should be configured via AWS Console or Terraform for security."
echo " Required: Target Group on Port 4000, Security Group allowing 80/443."
echo "✅ Basic infrastructure components (ECR, ECS Cluster, Logs) are ready."
echo "👉 Next steps: "
echo "1. Set up your RDS PostgreSQL database."
echo "2. Add your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to GitHub Secrets."
echo "3. Run the GitHub Action by pushing to 'main'."