# SAPIENS Web2 Enhanced version of SAPIENS Web with additional features and improved architecture. ## Overview SAPIENS Web2 is an evolved version of the SAPIENS platform, featuring enhanced user experience, improved performance, and additional functionality for news content delivery. ## 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-web2/ ├── 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 ├── scripts/ # Build and utility scripts ├── shared/ # Shared types and utilities └── dist/ # Build output ``` ## Key Improvements over Web v1 - Enhanced UI/UX with refined component library - Improved performance optimization - Additional API endpoints - Enhanced database schema - Better error handling and logging ## 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_db2 SESSION_SECRET=your-session-secret NODE_ENV=development PORT=5000 ``` ### Development ```bash # Start development server npm run dev # Type checking npm run check # Run scripts npm run scripts ``` ### 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 Extended API from Web v1 with additional endpoints: - `GET /api/outlets` - List news outlets - `GET /api/outlets/:id/articles` - Get articles from an outlet - `GET /api/articles/:id` - Get article details - `GET /api/categories` - List categories - `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 thoroughly 5. Submit a pull request ## Migration from Web v1 If migrating from SAPIENS Web v1: 1. Update database connection string 2. Run migrations: `npm run db:push` 3. Review and update environment variables 4. Test all features ## License Proprietary - All rights reserved