236 lines
4.8 KiB
Markdown
236 lines
4.8 KiB
Markdown
# MoreMinimore SAAS
|
|
|
|
A modern AI-powered web application development platform built with Next.js 16, TypeScript, and PostgreSQL.
|
|
|
|
## 🚀 Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Node.js 20 or higher
|
|
- PostgreSQL 14 or higher
|
|
- Redis (optional, for caching)
|
|
|
|
### Installation
|
|
|
|
1. Clone the repository:
|
|
```bash
|
|
git clone <repository-url>
|
|
cd Websitebuilder
|
|
```
|
|
|
|
2. Install dependencies:
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
3. Set up environment variables:
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
Edit `.env` with your configuration:
|
|
```env
|
|
DATABASE_URL=postgresql://user:password@localhost:5432/moreminimore
|
|
JWT_SECRET=your-secret-key-here
|
|
REDIS_URL=redis://localhost:6379
|
|
```
|
|
|
|
4. Run database migrations:
|
|
```bash
|
|
npm run db:migrate
|
|
```
|
|
|
|
5. Start the development server:
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
The application will be available at `http://localhost:3000`.
|
|
|
|
## 📁 Project Structure
|
|
|
|
```
|
|
src/
|
|
├── app/ # Next.js App Router pages
|
|
│ ├── api/ # API routes
|
|
│ │ ├── auth/ # Authentication endpoints
|
|
│ │ └── users/ # User management endpoints
|
|
│ ├── dashboard/ # Dashboard pages
|
|
│ └── admin/ # Admin pages
|
|
├── components/ # React components
|
|
│ ├── auth/ # Authentication components
|
|
│ ├── admin/ # Admin components
|
|
│ └── ui/ # shadcn/ui components
|
|
├── lib/ # Utility libraries
|
|
│ ├── auth/ # Authentication utilities
|
|
│ ├── db/ # Database configuration
|
|
│ └── utils.ts # Utility functions
|
|
└── services/ # Business logic services
|
|
├── auth.service.ts # Authentication service
|
|
└── user.service.ts # User management service
|
|
```
|
|
|
|
## 🧪 Testing
|
|
|
|
### Unit Tests
|
|
|
|
Run unit tests with Vitest:
|
|
```bash
|
|
npm test
|
|
```
|
|
|
|
Run tests with UI:
|
|
```bash
|
|
npm run test:ui
|
|
```
|
|
|
|
Run tests with coverage:
|
|
```bash
|
|
npm run test:coverage
|
|
```
|
|
|
|
Check coverage thresholds:
|
|
```bash
|
|
npm run test:coverage:check
|
|
```
|
|
|
|
### E2E Tests
|
|
|
|
Run E2E tests with Playwright:
|
|
```bash
|
|
npm run test:e2e
|
|
```
|
|
|
|
## 🏗️ Building
|
|
|
|
Build for production:
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
Start production server:
|
|
```bash
|
|
npm run start
|
|
```
|
|
|
|
## 📊 Coverage
|
|
|
|
We maintain high test coverage to ensure code quality:
|
|
|
|
- **Critical**: Business logic, data transformations (100%)
|
|
- **High**: Public APIs, user-facing features (90%+)
|
|
- **Medium**: Utilities, helpers (80%+)
|
|
|
|
Coverage reports are generated in the `coverage/` directory.
|
|
|
|
## 🔄 CI/CD
|
|
|
|
The project uses GitHub Actions for continuous integration and deployment:
|
|
|
|
### Workflow Triggers
|
|
- Push to `main` or `develop` branches
|
|
- Pull requests to `main` or `develop` branches
|
|
|
|
### CI Pipeline Stages
|
|
|
|
1. **Build**: Validates Next.js build
|
|
2. **Unit Tests**: Runs Vitest unit tests with coverage
|
|
3. **E2E Tests**: Runs Playwright tests
|
|
4. **Lint**: Runs ESLint
|
|
5. **Type Check**: Runs TypeScript type checking
|
|
|
|
### Coverage Enforcement
|
|
|
|
The CI pipeline enforces coverage thresholds:
|
|
- Lines: 80%
|
|
- Functions: 80%
|
|
- Branches: 80%
|
|
- Statements: 80%
|
|
|
|
Builds will fail if:
|
|
- Tests fail
|
|
- Coverage falls below thresholds
|
|
- Linting errors
|
|
- TypeScript errors
|
|
|
|
### Coverage Reports
|
|
|
|
Coverage reports are uploaded to Codecov for tracking and visualization.
|
|
|
|
## 🗄️ Database
|
|
|
|
### Running Migrations
|
|
|
|
Generate migration files:
|
|
```bash
|
|
npm run db:generate
|
|
```
|
|
|
|
Apply migrations:
|
|
```bash
|
|
npm run db:migrate
|
|
```
|
|
|
|
Push schema changes (development only):
|
|
```bash
|
|
npm run db:push
|
|
```
|
|
|
|
### Database Studio
|
|
|
|
Open Drizzle Studio for database management:
|
|
```bash
|
|
npm run db:studio
|
|
```
|
|
|
|
## 📝 Development
|
|
|
|
### Code Style
|
|
|
|
- Use TypeScript for type safety
|
|
- Follow the code standards in `/Users/kunthawatgreet/.config/opencode/context/core/standards/code-quality.md`
|
|
- Follow the testing standards in `/Users/kunthawatgreet/.config/opencode/context/core/standards/test-coverage.md`
|
|
|
|
### Commit Convention
|
|
|
|
Follow conventional commits:
|
|
- `feat:` - New features
|
|
- `fix:` - Bug fixes
|
|
- `docs:` - Documentation changes
|
|
- `test:` - Test changes
|
|
- `refactor:` - Code refactoring
|
|
- `chore:` - Maintenance tasks
|
|
|
|
### Branching Strategy
|
|
|
|
- `main` - Production branch
|
|
- `develop` - Development branch
|
|
- Feature branches from `develop`
|
|
|
|
## 🚢 Deployment
|
|
|
|
The application is designed to be deployed to Vercel, AWS, or any Node.js hosting platform.
|
|
|
|
### Environment Variables
|
|
|
|
Required environment variables:
|
|
- `DATABASE_URL` - PostgreSQL connection string
|
|
- `JWT_SECRET` - Secret for JWT tokens
|
|
- `REDIS_URL` - Redis connection string (optional)
|
|
|
|
## 📄 License
|
|
|
|
[Your License Here]
|
|
|
|
## 🤝 Contributing
|
|
|
|
1. Fork the repository
|
|
2. Create a feature branch
|
|
3. Make your changes
|
|
4. Run tests and ensure they pass
|
|
5. Submit a pull request
|
|
|
|
## 📞 Support
|
|
|
|
For support, please open an issue in the repository.
|