A simple multi-user wiki application built with Next.js, BetterAuth, Drizzle ORM, and Neon Postgres.
- Multi-user support: Users can sign up and sign in with email/password
- Article management: Create, edit, and view articles with markdown support
- Access control: Users can only edit their own articles
- Public viewing: Anyone can browse and read articles without logging in
- Next.js 15 - React framework with App Router
- BetterAuth - Authentication library
- Drizzle ORM - TypeScript ORM for database
- Neon Postgres - Serverless Postgres database
- shadcn/ui - UI component library
- Tailwind CSS - Styling
- React Markdown - Markdown rendering
- Playwright - E2E testing
- Node.js 20 or higher
- A Neon Postgres database account
- Clone or navigate to the project directory:
cd wiki- Install dependencies:
npm install- Set up environment variables:
Create a .env.local file in the root directory with the following:
DATABASE_URL=your-neon-connection-string-here
BETTER_AUTH_SECRET=your-secret-here
BETTER_AUTH_URL=http://localhost:3000You can generate a secret with:
openssl rand -base64 32- Run database migrations:
npm run db:generate
npm run db:migrateOr push the schema directly (for development):
npm run db:pushStart the development server:
npm run devOpen http://localhost:3000 in your browser.
Run Playwright tests:
npm testRun tests in UI mode:
npm run test:uiwiki/
├── app/
│ ├── actions/ # Server actions
│ ├── api/auth/ # Auth API routes
│ ├── article/ # Article pages
│ ├── login/ # Login page
│ ├── signup/ # Signup page
│ ├── page.tsx # Home page
│ ├── layout.tsx # Root layout
│ └── globals.css # Global styles
├── components/
│ ├── ui/ # shadcn UI components
│ ├── article-form.tsx # Article form component
│ ├── article-list.tsx # Article list component
│ ├── auth-button.tsx # Auth button component
│ └── markdown-renderer.tsx
├── db/
│ ├── schema.ts # Database schema
│ └── index.ts # Database client
├── lib/
│ ├── auth.ts # Auth server config
│ ├── auth-client.ts # Auth client
│ └── utils.ts # Utility functions
├── tests/
│ └── wiki.spec.ts # E2E tests
├── drizzle/
│ └── migrations/ # Database migrations
└── package.json
The application provides REST API endpoints that are consumed by our mobile app and other clients:
GET /api/articles/with-authors- Get all articles with author information and statisticsGET /api/articles/latest?limit=10- Get the latest articles (default: 10)GET /api/articles/[id]- Get a specific article by IDGET /api/articles/search?q=query- Search articles by title or content
GET /api/users/[id]/articles- Get all articles by a specific user
GET /api/stats- Get overall platform statistics (total articles, users, etc.)
Note: These endpoints are used by our iOS and Android mobile applications to provide a native experience for wiki readers and contributors.
- Browse all articles on the home page
- Click on article titles to read the full content
- View markdown-formatted articles
- Sign Up: Click "Sign Up" and create an account
- Sign In: Use your email and password to sign in
- Create Article: Click "Create Article" on the home page
- Edit Article: Click "Edit" on articles you've created
- Sign Out: Click "Sign Out" to end your session
The project uses:
- Prettier - Code formatting with minimal configuration
- Biome - Linting for correctness (not style)
MIT