|
| 1 | +# Development Guide |
| 2 | + |
| 3 | +This guide explains how to set up and work with the VideoSOS development environment. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Docker and Docker Compose installed |
| 8 | +- Git |
| 9 | + |
| 10 | +## Quick Start with Docker |
| 11 | + |
| 12 | +1. Clone the repository: |
| 13 | +```bash |
| 14 | +git clone https://github.com/timoncool/videosos |
| 15 | +cd videosos |
| 16 | +``` |
| 17 | + |
| 18 | +2. Start the development environment: |
| 19 | +```bash |
| 20 | +make up |
| 21 | +``` |
| 22 | + |
| 23 | +3. Open [http://localhost:3000](http://localhost:3000) |
| 24 | + |
| 25 | +## Available Commands |
| 26 | + |
| 27 | +### Docker Commands |
| 28 | + |
| 29 | +```bash |
| 30 | +make up # Start development environment |
| 31 | +make down # Stop development environment |
| 32 | +make restart # Restart development environment |
| 33 | +make logs # Show container logs |
| 34 | +make shell # Open shell in container |
| 35 | +``` |
| 36 | + |
| 37 | +### Code Quality Commands |
| 38 | + |
| 39 | +All these commands run inside the Docker container: |
| 40 | + |
| 41 | +```bash |
| 42 | +make lint # Run linters (Biome + ESLint) |
| 43 | +make format # Format code with Biome |
| 44 | +make type-check # Run TypeScript type checking |
| 45 | +make check # Run all checks (lint + type-check) |
| 46 | +``` |
| 47 | + |
| 48 | +### Build Commands |
| 49 | + |
| 50 | +```bash |
| 51 | +make build # Build Next.js application |
| 52 | +make clean # Remove build artifacts |
| 53 | +``` |
| 54 | + |
| 55 | +## Development Workflow |
| 56 | + |
| 57 | +### 1. Start Development Server |
| 58 | + |
| 59 | +```bash |
| 60 | +make up |
| 61 | +``` |
| 62 | + |
| 63 | +The Next.js development server will start with hot-reload enabled. |
| 64 | + |
| 65 | +### 2. Make Changes |
| 66 | + |
| 67 | +Edit files in your IDE. Changes will be reflected immediately thanks to hot-reload. |
| 68 | + |
| 69 | +### 3. Check Code Quality |
| 70 | + |
| 71 | +Before committing, run: |
| 72 | + |
| 73 | +```bash |
| 74 | +make check |
| 75 | +``` |
| 76 | + |
| 77 | +This will: |
| 78 | +- Run Biome linter and formatter |
| 79 | +- Run ESLint |
| 80 | +- Run TypeScript type checking |
| 81 | + |
| 82 | +### 4. Format Code |
| 83 | + |
| 84 | +To auto-format your code: |
| 85 | + |
| 86 | +```bash |
| 87 | +make format |
| 88 | +``` |
| 89 | + |
| 90 | +### 5. Access Container Shell |
| 91 | + |
| 92 | +If you need to run commands inside the container: |
| 93 | + |
| 94 | +```bash |
| 95 | +make shell |
| 96 | +``` |
| 97 | + |
| 98 | +## Code Quality Tools |
| 99 | + |
| 100 | +### Biome |
| 101 | + |
| 102 | +Biome is our primary linter and formatter. It's fast and configured in `biome.json`. |
| 103 | + |
| 104 | +Configuration: |
| 105 | +- Format style: 2 spaces, double quotes |
| 106 | +- Linting: recommended rules enabled |
| 107 | +- Auto-fix on save (when using `make lint`) |
| 108 | + |
| 109 | +### ESLint |
| 110 | + |
| 111 | +ESLint with Next.js config for additional React-specific checks. |
| 112 | + |
| 113 | +### TypeScript |
| 114 | + |
| 115 | +Strict type checking is enabled. Run `make type-check` to verify types. |
| 116 | + |
| 117 | +## Pre-commit Hooks |
| 118 | + |
| 119 | +Husky is configured to run formatting before each commit: |
| 120 | +- `.husky/pre-commit` - runs `npm run format` |
| 121 | + |
| 122 | +## Troubleshooting |
| 123 | + |
| 124 | +### Port 3000 already in use |
| 125 | + |
| 126 | +```bash |
| 127 | +make down |
| 128 | +# Kill any process using port 3000 |
| 129 | +make up |
| 130 | +``` |
| 131 | + |
| 132 | +### Container not starting |
| 133 | + |
| 134 | +```bash |
| 135 | +make logs # Check logs for errors |
| 136 | +``` |
| 137 | + |
| 138 | +### Hot reload not working |
| 139 | + |
| 140 | +Try restarting: |
| 141 | +```bash |
| 142 | +make restart |
| 143 | +``` |
| 144 | + |
| 145 | +### Clear caches |
| 146 | + |
| 147 | +```bash |
| 148 | +make clean |
| 149 | +``` |
| 150 | + |
| 151 | +## Manual Development (without Docker) |
| 152 | + |
| 153 | +If you prefer to run without Docker: |
| 154 | + |
| 155 | +1. Install dependencies: |
| 156 | +```bash |
| 157 | +npm install |
| 158 | +``` |
| 159 | + |
| 160 | +2. Start dev server: |
| 161 | +```bash |
| 162 | +npm run dev |
| 163 | +``` |
| 164 | + |
| 165 | +3. Run checks: |
| 166 | +```bash |
| 167 | +npm run check |
| 168 | +``` |
| 169 | + |
| 170 | +## Environment Variables |
| 171 | + |
| 172 | +API keys are stored in browser's localStorage. No `.env` file needed for development. |
| 173 | + |
| 174 | +Configure your API keys in the app settings (gear icon). |
| 175 | + |
| 176 | +## Contributing |
| 177 | + |
| 178 | +Before submitting a PR: |
| 179 | + |
| 180 | +1. Run `make check` to ensure code quality |
| 181 | +2. Test your changes locally |
| 182 | +3. Follow [CONTRIBUTING.md](CONTRIBUTING.md) guidelines |
| 183 | +4. Write atomic commits with clear messages |
| 184 | + |
| 185 | +## Resources |
| 186 | + |
| 187 | +- [Next.js Documentation](https://nextjs.org/docs) |
| 188 | +- [Biome Documentation](https://biomejs.dev) |
| 189 | +- [Remotion Documentation](https://remotion.dev) |
| 190 | + |
0 commit comments