Files
sapiens-web/README.md
jungwoo choi 7c893dac8a docs: Add comprehensive README for SAPIENS Web
- Full-stack setup with React, Express, and PostgreSQL
- Database management with Drizzle ORM
- Authentication and session management
- API endpoints documentation
- Development and deployment guidelines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-23 14:50:07 +09:00

132 lines
2.9 KiB
Markdown

# SAPIENS Web
Full-stack web application for the SAPIENS news platform built with React, Express, and PostgreSQL.
## Overview
SAPIENS Web is a modern web application providing a rich user experience for browsing and reading curated news content. Built with a robust tech stack featuring React 18, Express, and PostgreSQL with Drizzle ORM.
## Tech Stack
### Frontend
- **Framework**: React 18.3 with Vite 5.4
- **Language**: TypeScript 5.6
- **Styling**: Tailwind CSS 3.4 with shadcn/ui components
- **State Management**: TanStack React Query 5.60
- **Routing**: Wouter 3.3
- **UI Library**: Radix UI primitives
### Backend
- **Runtime**: Node.js with Express 4.21
- **Database**: PostgreSQL with Drizzle ORM 0.44
- **Authentication**: Passport.js with local and OpenID strategies
- **Session**: express-session with PostgreSQL store
## Project Structure
```
sapiens-web/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── hooks/ # Custom React hooks
│ │ └── lib/ # Utilities
├── server/ # Express backend
│ ├── index.ts # Server entry point
│ ├── routes.ts # API routes
│ └── db/ # Database schemas
├── shared/ # Shared types and utilities
└── dist/ # Build output
```
## Features
- Server-side rendering with Express
- PostgreSQL database with Drizzle ORM
- Authentication system with Passport.js
- Session management
- Responsive design with Tailwind CSS
- Real-time updates with WebSocket
- Rich UI components from shadcn/ui
## Getting Started
### Prerequisites
- Node.js 18+ and npm/yarn
- PostgreSQL 14+
### Installation
```bash
# Install dependencies
npm install
# Set up database
npm run db:push
```
### Environment Variables
Create a `.env` file:
```env
DATABASE_URL=postgresql://user:password@localhost:5432/sapiens_db
SESSION_SECRET=your-session-secret
NODE_ENV=development
PORT=5000
```
### Development
```bash
# Start development server
npm run dev
# Type checking
npm run check
```
### Production Build
```bash
# Build the application
npm run build
# Start production server
npm start
```
## Database Management
```bash
# Push schema changes to database
npm run db:push
# Generate migrations
drizzle-kit generate
# Run migrations
drizzle-kit migrate
```
## API Endpoints
- `GET /api/outlets` - List news outlets
- `GET /api/outlets/:id/articles` - Get articles from an outlet
- `GET /api/articles/:id` - Get article details
- `POST /api/auth/login` - User login
- `POST /api/auth/register` - User registration
## Contributing
1. Create a feature branch
2. Make your changes
3. Run type checking with `npm run check`
4. Test your changes
5. Submit a pull request
## License
Proprietary - All rights reserved