Skip to content

Commit 6584037

Browse files
nullcoderclaude
andauthored
feat: create project folder structure (#23)
* feat: create project folder structure - Added app router page structure with /create and /g/[id] routes - Created placeholder pages for viewing and creating gists - Added README files for all main directories explaining conventions - Created types directory for TypeScript interfaces - Updated TODO.md to mark completed tasks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: make dynamic route page async for Next.js 15 compatibility - Convert ViewGistPage to async function - Await params Promise as required in Next.js 15 - Add gist ID display for testing - This prepares the component for future async operations like fetching gist data 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a0b2763 commit 6584037

File tree

7 files changed

+205
-2
lines changed

7 files changed

+205
-2
lines changed

app/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# App Directory
2+
3+
This directory contains the Next.js 15 App Router pages and routes.
4+
5+
## Structure
6+
7+
```
8+
app/
9+
├── layout.tsx # Root layout with providers
10+
├── page.tsx # Home page (/)
11+
├── globals.css # Global styles and Tailwind imports
12+
├── create/
13+
│ └── page.tsx # Create new gist page (/create)
14+
├── g/
15+
│ └── [id]/
16+
│ └── page.tsx # View gist page (/g/[id])
17+
└── api/ # API routes (will be added in Phase 5)
18+
```
19+
20+
## Conventions
21+
22+
- All pages use `export default` for the page component
23+
- Dynamic route parameters use `params: Promise<{ paramName: string }>` in Next.js 15
24+
- All routes are configured for edge runtime compatibility
25+
- Use async components where needed for data fetching
26+
- Follow the colocation pattern for route-specific components
27+
28+
## Route Overview
29+
30+
- `/` - Landing page with create gist form
31+
- `/create` - Dedicated page for creating new gists (alternative to home)
32+
- `/g/[id]` - View a specific gist by ID (requires decryption key in URL fragment)

app/create/page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default function CreateGistPage() {
2+
return (
3+
<div className="container mx-auto py-8">
4+
<h1 className="mb-4 text-2xl font-bold">Create New Gist</h1>
5+
<p className="text-muted-foreground">
6+
This page will contain the form for creating encrypted gists.
7+
</p>
8+
</div>
9+
);
10+
}

app/g/[id]/page.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export default async function ViewGistPage({
2+
params,
3+
}: {
4+
params: Promise<{ id: string }>;
5+
}) {
6+
const { id } = await params;
7+
8+
return (
9+
<div className="container mx-auto py-8">
10+
<h1 className="mb-4 text-2xl font-bold">View Gist</h1>
11+
<p className="text-muted-foreground">
12+
This page will display the gist viewer for viewing encrypted gists.
13+
</p>
14+
<p className="text-muted-foreground mt-2 text-sm">Gist ID: {id}</p>
15+
</div>
16+
);
17+
}

components/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Components Directory
2+
3+
This directory contains all React components used throughout the application.
4+
5+
## Structure
6+
7+
```
8+
components/
9+
├── ui/ # shadcn/ui components (auto-generated)
10+
├── theme-provider.tsx
11+
├── theme-toggle.tsx
12+
└── [future components will be added here]
13+
```
14+
15+
## Conventions
16+
17+
- All components are written in TypeScript with proper type definitions
18+
- Components use the `.tsx` extension
19+
- Follow the single responsibility principle - each component has one clear purpose
20+
- Use `"use client"` directive only when necessary (client-side interactivity)
21+
- Prefer composition over inheritance
22+
- Export components as named exports (except for pages)
23+
24+
## Component Categories (to be implemented)
25+
26+
### Layout Components
27+
28+
- Header - Main navigation
29+
- Footer - Site information
30+
- Container - Consistent spacing wrapper
31+
32+
### Form Components
33+
34+
- FileTab - Multi-file support
35+
- CodeEditor - CodeMirror wrapper
36+
- ExpirySelector - Expiration time picker
37+
- PINInput - Secure PIN entry
38+
- ShareDialog - Share link with copy
39+
40+
### Display Components
41+
42+
- GistViewer - Display encrypted gists
43+
- FileList - List of files in a gist
44+
- LoadingStates - Loading indicators
45+
- ErrorBoundary - Error handling
46+
47+
## Styling
48+
49+
- Use Tailwind CSS classes via `cn()` utility
50+
- Follow shadcn/ui patterns for consistency
51+
- Support both light and dark themes
52+
- Ensure responsive design

docs/TODO.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ This document tracks the implementation progress of GhostPaste. Check off tasks
3030

3131
### Project Structure
3232

33-
- [ ] Create folder structure (`app/`, `components/`, `lib/`, `types/`) - [#11](https://github.com/nullcoder/ghostpaste/issues/11)
34-
- [ ] Set up app router pages structure - [#11](https://github.com/nullcoder/ghostpaste/issues/11)
33+
- [x] Create folder structure (`app/`, `components/`, `lib/`, `types/`) - [#11](https://github.com/nullcoder/ghostpaste/issues/11)
34+
- [x] Set up app router pages structure - [#11](https://github.com/nullcoder/ghostpaste/issues/11)
3535
- [x] Create base layout with theme provider - [#8](https://github.com/nullcoder/ghostpaste/issues/8)
3636
- [x] Set up global styles and CSS variables - [#8](https://github.com/nullcoder/ghostpaste/issues/8)
3737
- [ ] Verify Cloudflare R2 setup - [#12](https://github.com/nullcoder/ghostpaste/issues/12)

lib/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Lib Directory
2+
3+
This directory contains utility functions, business logic, and service modules.
4+
5+
## Structure
6+
7+
```
8+
lib/
9+
├── utils.ts # General utility functions (cn, etc.)
10+
└── [future modules will be added here]
11+
```
12+
13+
## Planned Modules (to be implemented)
14+
15+
### Core Modules
16+
17+
- `crypto.ts` - Encryption/decryption utilities using Web Crypto API
18+
- `storage.ts` - Cloudflare R2 storage client wrapper
19+
- `binary.ts` - Binary format encoding/decoding for file storage
20+
- `auth.ts` - PIN hashing and validation
21+
22+
### Utilities
23+
24+
- `logger.ts` - Structured logging utility
25+
- `errors.ts` - Custom error classes and handling
26+
- `validation.ts` - Input validation helpers
27+
- `constants.ts` - Application constants and limits
28+
29+
## Conventions
30+
31+
- All modules must be edge runtime compatible (no Node.js APIs)
32+
- Use Web Crypto API for cryptographic operations
33+
- Export functions and constants as named exports
34+
- Write pure functions where possible
35+
- Include comprehensive error handling
36+
- Add JSDoc comments for public APIs
37+
38+
## Edge Runtime Compatibility
39+
40+
All code in this directory must work in Cloudflare Workers:
41+
42+
- No `fs`, `path`, or other Node.js modules
43+
- Use Web APIs (fetch, crypto, etc.)
44+
- Keep bundle sizes small
45+
- Consider CPU time limits (50ms)
46+
- Handle streaming for large data

types/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Types Directory
2+
3+
This directory contains TypeScript type definitions and interfaces used throughout the application.
4+
5+
## Structure
6+
7+
```
8+
types/
9+
├── index.ts # Main export file for all types
10+
└── [type files will be added here]
11+
```
12+
13+
## Planned Type Definitions (to be implemented)
14+
15+
### Data Models
16+
17+
- `GistMetadata` - Metadata stored in R2 (unencrypted)
18+
- `EncryptedData` - Structure of encrypted blob data
19+
- `UserMetadata` - User-related metadata
20+
21+
### API Types
22+
23+
- `APIResponse` - Standardized API response format
24+
- `APIError` - Error response structure
25+
- Request/Response types for each endpoint
26+
27+
### Application Types
28+
29+
- `File` - Individual file in a gist
30+
- `GistOptions` - Creation options (expiry, PIN, etc.)
31+
- `BinaryFormat` - Binary encoding format structure
32+
33+
## Conventions
34+
35+
- Use `interface` for object shapes
36+
- Use `type` for unions, aliases, and complex types
37+
- Export all types from `index.ts` for easy imports
38+
- Prefix enum values with the enum name
39+
- Document complex types with JSDoc comments
40+
- Avoid using `any` - use `unknown` if type is truly unknown
41+
42+
## Example Import
43+
44+
```typescript
45+
import { GistMetadata, APIResponse } from "@/types";
46+
```

0 commit comments

Comments
 (0)