Skip to content

Commit 07bb278

Browse files
committed
Initial commit: scaffold with Next.js, tooling, database
0 parents  commit 07bb278

28 files changed

+8538
-0
lines changed

.eslintrc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"extends": [
3+
"next/core-web-vitals",
4+
"@typescript-eslint/recommended"
5+
],
6+
"parser": "@typescript-eslint/parser",
7+
"plugins": ["@typescript-eslint"],
8+
"rules": {
9+
"@typescript-eslint/no-unused-vars": "error",
10+
"@typescript-eslint/no-explicit-any": "warn",
11+
"@typescript-eslint/explicit-function-return-type": "off",
12+
"@typescript-eslint/explicit-module-boundary-types": "off",
13+
"prefer-const": "error",
14+
"no-var": "error"
15+
},
16+
"ignorePatterns": [
17+
"node_modules/",
18+
".next/",
19+
"out/",
20+
"build/",
21+
"dist/"
22+
]
23+
}

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:15
16+
env:
17+
POSTGRES_PASSWORD: postgres
18+
POSTGRES_DB: collabpad_test
19+
options: >-
20+
--health-cmd pg_isready
21+
--health-interval 10s
22+
--health-timeout 5s
23+
--health-retries 5
24+
ports:
25+
- 5432:5432
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '18'
34+
35+
- name: Setup pnpm
36+
uses: pnpm/action-setup@v4
37+
with:
38+
version: 8
39+
40+
- name: Get pnpm store directory
41+
shell: bash
42+
run: |
43+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
44+
45+
- name: Setup pnpm cache
46+
uses: actions/cache@v4
47+
with:
48+
path: ${{ env.STORE_PATH }}
49+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
50+
restore-keys: |
51+
${{ runner.os }}-pnpm-store-
52+
53+
- name: Install dependencies
54+
run: pnpm install --frozen-lockfile
55+
56+
- name: Generate Prisma client
57+
run: pnpm db:generate
58+
59+
- name: Run type checking
60+
run: pnpm type-check
61+
62+
- name: Run linting
63+
run: pnpm lint
64+
65+
- name: Check code formatting
66+
run: pnpm format:check
67+
68+
- name: Run tests
69+
run: pnpm test
70+
env:
71+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/collabpad_test
72+
73+
- name: Build application
74+
run: pnpm build

.gitignore

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#Project files
2+
roadmap.txt
3+
4+
# Dependencies
5+
node_modules/
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
pnpm-debug.log*
10+
11+
# Next.js
12+
.next/
13+
out/
14+
build/
15+
dist/
16+
17+
# Environment variables
18+
.env
19+
.env.local
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
24+
# Vercel
25+
.vercel
26+
27+
# TypeScript
28+
*.tsbuildinfo
29+
30+
# IDE
31+
.vscode/
32+
.idea/
33+
*.swp
34+
*.swo
35+
36+
# OS
37+
.DS_Store
38+
Thumbs.db
39+
40+
# Logs
41+
logs
42+
*.log
43+
44+
# Runtime data
45+
pids
46+
*.pid
47+
*.seed
48+
*.pid.lock
49+
50+
# Coverage directory used by tools like istanbul
51+
coverage/
52+
*.lcov
53+
54+
# nyc test coverage
55+
.nyc_output
56+
57+
# Dependency directories
58+
jspm_packages/
59+
60+
# Optional npm cache directory
61+
.npm
62+
63+
# Optional eslint cache
64+
.eslintcache
65+
66+
# Microbundle cache
67+
.rpt2_cache/
68+
.rts2_cache_cjs/
69+
.rts2_cache_es/
70+
.rts2_cache_umd/
71+
72+
# Optional REPL history
73+
.node_repl_history
74+
75+
# Output of 'npm pack'
76+
*.tgz
77+
78+
# Yarn Integrity file
79+
.yarn-integrity
80+
81+
# parcel-bundler cache (https://parceljs.org/)
82+
.cache
83+
.parcel-cache
84+
85+
# Stores VSCode versions used for testing VSCode extensions
86+
.vscode-test
87+
88+
# yarn v2
89+
.yarn/cache
90+
.yarn/unplugged
91+
.yarn/build-state.yml
92+
.yarn/install-state.gz
93+
.pnp.*
94+
95+
# Database
96+
*.db
97+
*.sqlite
98+
99+
# Prisma
100+
prisma/migrations/

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"bracketSpacing": true,
9+
"arrowParens": "avoid"
10+
}

README.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# CollabPad
2+
3+
A real-time collaborative markdown editor with CRDT sync, built with Next.js 14, TypeScript, and Yjs.
4+
5+
## 🚀 Features
6+
7+
- **Real-time Collaboration**: Google Docs-style live editing with multiple cursors
8+
- **CRDT Sync**: Conflict-free replicated data types for reliable collaboration
9+
- **Markdown Editor**: Rich text editing powered by TipTap
10+
- **Authentication**: GitHub OAuth integration with NextAuth
11+
- **Type Safety**: Full-stack TypeScript with tRPC
12+
- **Modern Stack**: Next.js 14, Prisma, PostgreSQL, Redis
13+
14+
## 🛠️ Tech Stack
15+
16+
- **Frontend**: Next.js 14, React 18, TypeScript
17+
- **Backend**: tRPC, Prisma, PostgreSQL
18+
- **Real-time**: Yjs, y-websocket
19+
- **Editor**: TipTap
20+
- **Auth**: NextAuth.js
21+
- **Styling**: Tailwind CSS
22+
- **Testing**: Jest, React Testing Library
23+
24+
## 📋 Prerequisites
25+
26+
- Node.js 18+
27+
- pnpm (recommended) or npm
28+
- Docker & Docker Compose
29+
- PostgreSQL
30+
- Redis
31+
32+
## 🚀 Quick Start
33+
34+
1. **Clone the repository**
35+
```bash
36+
git clone <your-repo-url>
37+
cd collabpad
38+
```
39+
40+
2. **Install dependencies**
41+
```bash
42+
pnpm install
43+
```
44+
45+
3. **Set up environment variables**
46+
```bash
47+
cp .env.example .env.local
48+
# Edit .env.local with your configuration
49+
```
50+
51+
4. **Start the development stack**
52+
```bash
53+
docker-compose up -d
54+
```
55+
56+
5. **Run database migrations**
57+
```bash
58+
pnpm db:generate
59+
pnpm db:push
60+
```
61+
62+
6. **Start the development server**
63+
```bash
64+
pnpm dev
65+
```
66+
67+
7. **Open your browser**
68+
Navigate to [http://localhost:3000](http://localhost:3000)
69+
70+
## 📁 Project Structure
71+
72+
```
73+
collabpad/
74+
├── src/
75+
│ ├── app/ # Next.js 14 app directory
76+
│ ├── components/ # React components
77+
│ ├── lib/ # Utilities and configurations
78+
│ ├── server/ # tRPC server setup
79+
│ └── types/ # TypeScript type definitions
80+
├── prisma/ # Database schema and migrations
81+
├── docker-compose.yml # Development environment
82+
└── roadmap.txt # Development roadmap
83+
```
84+
85+
## 🧪 Development
86+
87+
### Available Scripts
88+
89+
- `pnpm dev` - Start development server
90+
- `pnpm build` - Build for production
91+
- `pnpm start` - Start production server
92+
- `pnpm lint` - Run ESLint
93+
- `pnpm lint:fix` - Fix ESLint errors
94+
- `pnpm format` - Format code with Prettier
95+
- `pnpm test` - Run tests
96+
- `pnpm type-check` - Run TypeScript type checking
97+
98+
### Database Commands
99+
100+
- `pnpm db:generate` - Generate Prisma client
101+
- `pnpm db:push` - Push schema to database
102+
- `pnpm db:migrate` - Run database migrations
103+
- `pnpm db:studio` - Open Prisma Studio
104+
105+
## 🐳 Docker Development
106+
107+
The project includes a Docker Compose setup for easy development:
108+
109+
```bash
110+
# Start all services
111+
docker-compose up -d
112+
113+
# View logs
114+
docker-compose logs -f
115+
116+
# Stop all services
117+
docker-compose down
118+
```
119+
120+
## 📊 Roadmap
121+
122+
See [roadmap.txt](./roadmap.txt) for detailed development milestones and progress.
123+
124+
**Current Focus**: Milestone 2 - Realtime CRDT Sync (Target: 35 hours)
125+
126+
## 🤝 Contributing
127+
128+
1. Fork the repository
129+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
130+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
131+
4. Push to the branch (`git push origin feature/amazing-feature`)
132+
5. Open a Pull Request
133+
134+
## 📄 License
135+
136+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
137+
138+
## 🙏 Acknowledgments
139+
140+
- [Yjs](https://github.com/yjs/yjs) for CRDT implementation
141+
- [TipTap](https://tiptap.dev/) for the rich text editor
142+
- [tRPC](https://trpc.io/) for type-safe APIs
143+
- [Next.js](https://nextjs.org/) for the React framework

docker-compose.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: '3.8'
2+
3+
services:
4+
postgres:
5+
image: postgres:15-alpine
6+
container_name: collabpad-postgres
7+
environment:
8+
POSTGRES_DB: collabpad
9+
POSTGRES_USER: postgres
10+
POSTGRES_PASSWORD: postgres
11+
ports:
12+
- "5432:5432"
13+
volumes:
14+
- postgres_data:/var/lib/postgresql/data
15+
healthcheck:
16+
test: ["CMD-SHELL", "pg_isready -U postgres"]
17+
interval: 10s
18+
timeout: 5s
19+
retries: 5
20+
21+
redis:
22+
image: redis:7-alpine
23+
container_name: collabpad-redis
24+
ports:
25+
- "6379:6379"
26+
volumes:
27+
- redis_data:/data
28+
healthcheck:
29+
test: ["CMD", "redis-cli", "ping"]
30+
interval: 10s
31+
timeout: 5s
32+
retries: 5
33+
34+
volumes:
35+
postgres_data:
36+
redis_data:

0 commit comments

Comments
 (0)