- Latest iteration with cutting-edge features - Public asset serving and PWA support - Performance optimization strategies - Extended API endpoints with advanced features - Migration guide from Web2 - Comprehensive deployment guide 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
SAPIENS Web3
Latest iteration of SAPIENS Web platform with cutting-edge features and optimizations.
Overview
SAPIENS Web3 represents the most advanced version of the SAPIENS platform, incorporating modern web technologies, enhanced user experience, and additional features including public asset serving and improved 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-web3/
├── 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
├── public/ # Static assets
├── scripts/ # Build and utility scripts
├── shared/ # Shared types and utilities
└── dist/ # Build output
Key Features
New in Web3
- Public asset serving with optimized delivery
- Enhanced media handling
- Improved caching strategies
- Advanced API endpoints
- Better SEO optimization
- Progressive Web App (PWA) support
Improvements over Web2
- Enhanced performance with optimized bundling
- Improved database query optimization
- Better error handling and monitoring
- Advanced authentication features
- Enhanced security measures
Getting Started
Prerequisites
- Node.js 18+ and npm/yarn
- PostgreSQL 14+
Installation
# Install dependencies
npm install
# Set up database
npm run db:push
Environment Variables
Create a .env file:
DATABASE_URL=postgresql://user:password@localhost:5432/sapiens_db3
SESSION_SECRET=your-session-secret
NODE_ENV=development
PORT=5000
PUBLIC_URL=http://localhost:5000
Development
# Start development server
npm run dev
# Type checking
npm run check
# Run utility scripts
npm run scripts
Production Build
# Build the application
npm run build
# Start production server
npm start
Database Management
# Push schema changes to database
npm run db:push
# Generate migrations
drizzle-kit generate
# Run migrations
drizzle-kit migrate
API Endpoints
Full REST API with extended features:
GET /api/outlets- List news outlets with filteringGET /api/outlets/:id/articles- Get articles with paginationGET /api/articles/:id- Get article details with related contentGET /api/categories- List all categoriesGET /api/trending- Get trending articlesPOST /api/auth/login- User loginPOST /api/auth/register- User registrationPOST /api/bookmarks- Manage user bookmarks
Public Assets
Static files are served from the /public directory and accessible at /public/*. This includes:
- Images
- Icons
- Fonts
- Other static resources
Performance Optimization
- Code splitting with dynamic imports
- Image optimization
- CSS purging in production
- Gzip compression
- Browser caching strategies
Contributing
- Create a feature branch from
main - Make your changes following the code style
- Run type checking:
npm run check - Test all features thoroughly
- Update documentation if needed
- Submit a pull request with clear description
Migration Guide
From Web2 to Web3
- Update database connection to use new database
- Run migrations:
npm run db:push - Update environment variables
- Move static assets to
/publicdirectory - Test all endpoints and features
Deployment
For production deployment:
- Set
NODE_ENV=production - Build the application:
npm run build - Configure reverse proxy (Nginx recommended)
- Set up SSL certificates
- Configure database connection pooling
- Enable monitoring and logging
License
Proprietary - All rights reserved
Description
Languages
JavaScript
62.9%
TypeScript
32.6%
HTML
4.1%
CSS
0.4%