|
| 1 | +# Development Environment Guide |
| 2 | + |
| 3 | +SimpleAccounts-UAE supports **two development environments**. Choose the one that fits your workflow: |
| 4 | + |
| 5 | +## 🚀 Quick Start |
| 6 | + |
| 7 | +| Environment | When to Use | Setup Time | |
| 8 | +| ---------------------- | -------------------------------------- | ------------ | |
| 9 | +| **Coder Cloud** | Remote development, team collaboration | 2 minutes | |
| 10 | +| **Local Devcontainer** | Offline development, full control | 5-10 minutes | |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## ☁️ Option 1: Coder Cloud Workspace (Recommended) |
| 15 | + |
| 16 | +### Prerequisites |
| 17 | + |
| 18 | +- Coder account at https://coder.dev.simpleaccounts.io |
| 19 | +- VS Code or Cursor IDE |
| 20 | +- Coder extension installed |
| 21 | + |
| 22 | +### Setup Steps |
| 23 | + |
| 24 | +1. **Install Coder Extension** |
| 25 | + |
| 26 | + ``` |
| 27 | + VS Code/Cursor → Extensions → Search "Coder" → Install |
| 28 | + ``` |
| 29 | + |
| 30 | +2. **Connect to Coder** |
| 31 | + |
| 32 | + ``` |
| 33 | + Command Palette (Cmd+Shift+P) |
| 34 | + → "Coder: Login" |
| 35 | + → URL: https://coder.dev.simpleaccounts.io |
| 36 | + → Paste your session token |
| 37 | + ``` |
| 38 | + |
| 39 | +3. **Open Workspace** |
| 40 | + ``` |
| 41 | + → "Coder: Open Workspace" |
| 42 | + → Select: SimpleAccounts-UAE |
| 43 | + ``` |
| 44 | + |
| 45 | +### ⚠️ Important: Don't Use Devcontainer in Coder |
| 46 | + |
| 47 | +When connecting to Coder: |
| 48 | + |
| 49 | +- ❌ **DO NOT** click "Reopen in Container" if prompted |
| 50 | +- ❌ **DO NOT** use Remote-Containers extension |
| 51 | +- ✅ **DO** use Coder extension or plain Remote-SSH |
| 52 | + |
| 53 | +**Why?** The Coder workspace is already a fully configured container. Using devcontainer creates nested containers and causes permission errors. |
| 54 | + |
| 55 | +### What's Included |
| 56 | + |
| 57 | +- ✅ PostgreSQL (auto-configured) |
| 58 | +- ✅ Redis (auto-configured) |
| 59 | +- ✅ All CLI tools (Maven, npm, gh, etc.) |
| 60 | +- ✅ VS Code extensions pre-installed |
| 61 | +- ✅ Automatic updates |
| 62 | + |
| 63 | +### Quick Commands |
| 64 | + |
| 65 | +```bash |
| 66 | +# Frontend |
| 67 | +cd apps/frontend && npm run dev |
| 68 | + |
| 69 | +# Backend |
| 70 | +cd apps/backend && ./mvnw spring-boot:run |
| 71 | +``` |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## 🏠 Option 2: Local Devcontainer |
| 76 | + |
| 77 | +### Prerequisites |
| 78 | + |
| 79 | +- Docker Desktop installed and running |
| 80 | +- VS Code with Remote-Containers extension |
| 81 | +- At least 8GB RAM available |
| 82 | + |
| 83 | +### Setup Steps |
| 84 | + |
| 85 | +1. **Open in VS Code** |
| 86 | + |
| 87 | + ``` |
| 88 | + code /path/to/SimpleAccounts-UAE |
| 89 | + ``` |
| 90 | + |
| 91 | +2. **Reopen in Container** |
| 92 | + |
| 93 | + ``` |
| 94 | + Command Palette → "Dev Containers: Reopen in Container" |
| 95 | + OR |
| 96 | + Click "Reopen in Container" when prompted |
| 97 | + ``` |
| 98 | + |
| 99 | +3. **Wait for Setup** (5-10 minutes first time) |
| 100 | + - Downloads Docker images |
| 101 | + - Installs dependencies |
| 102 | + - Configures database |
| 103 | + |
| 104 | +### What Happens |
| 105 | + |
| 106 | +- Creates PostgreSQL container |
| 107 | +- Creates Redis container |
| 108 | +- Creates devcontainer with all tools |
| 109 | +- Runs post-create setup scripts |
| 110 | + |
| 111 | +### Configuration Files |
| 112 | + |
| 113 | +- `.devcontainer/devcontainer.json` - VS Code config |
| 114 | +- `.devcontainer/docker-compose.yml` - Container setup |
| 115 | +- `.devcontainer/Dockerfile` - Container image |
| 116 | +- `.devcontainer/post-create.sh` - One-time setup |
| 117 | +- `.devcontainer/post-start.sh` - Runs on each start |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## 🔧 Troubleshooting |
| 122 | + |
| 123 | +### "Reopen in Container" in Coder |
| 124 | + |
| 125 | +**Problem:** VS Code prompts to reopen in container when connected to Coder |
| 126 | +**Solution:** Click "Cancel" or "Don't Reopen" - you're already in a container! |
| 127 | + |
| 128 | +### Permission Denied Errors |
| 129 | + |
| 130 | +**Problem:** `mkdir: cannot create directory: Permission denied` |
| 131 | +**Solution:** |
| 132 | + |
| 133 | +- In Coder: Should be fixed by PR #419 |
| 134 | +- In Local: Rebuild container (`Dev Containers: Rebuild Container`) |
| 135 | + |
| 136 | +### Maven 403 Forbidden |
| 137 | + |
| 138 | +**Problem:** Maven can't download dependencies |
| 139 | +**Solution:** Fixed by PR #418 (Maven settings.xml auto-installed) |
| 140 | + |
| 141 | +### npm EACCES Errors |
| 142 | + |
| 143 | +**Problem:** npm can't write files |
| 144 | +**Solution:** Fixed by PR #419 (workspace ownership) |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## 🏗️ Architecture |
| 149 | + |
| 150 | +### Local Devcontainer Stack |
| 151 | + |
| 152 | +``` |
| 153 | +┌─────────────────────────────────┐ |
| 154 | +│ VS Code (your machine) │ |
| 155 | +└────────────┬────────────────────┘ |
| 156 | + │ |
| 157 | +┌────────────▼────────────────────┐ |
| 158 | +│ Docker Desktop │ |
| 159 | +│ ┌──────────────────────────┐ │ |
| 160 | +│ │ Devcontainer │ │ |
| 161 | +│ │ - Node.js, Java, Tools │ │ |
| 162 | +│ └──────────────────────────┘ │ |
| 163 | +│ ┌──────────────────────────┐ │ |
| 164 | +│ │ PostgreSQL Container │ │ |
| 165 | +│ └──────────────────────────┘ │ |
| 166 | +│ ┌──────────────────────────┐ │ |
| 167 | +│ │ Redis Container │ │ |
| 168 | +│ └──────────────────────────┘ │ |
| 169 | +└─────────────────────────────────┘ |
| 170 | +``` |
| 171 | + |
| 172 | +### Coder Cloud Stack |
| 173 | + |
| 174 | +``` |
| 175 | +┌─────────────────────────────────┐ |
| 176 | +│ VS Code (your machine) │ |
| 177 | +│ + Coder Extension │ |
| 178 | +└────────────┬────────────────────┘ |
| 179 | + │ SSH/WebSocket |
| 180 | +┌────────────▼────────────────────┐ |
| 181 | +│ Coder Workspace (cloud) │ |
| 182 | +│ ┌──────────────────────────┐ │ |
| 183 | +│ │ Main Container │ │ |
| 184 | +│ │ - All tools included │ │ |
| 185 | +│ │ - PostgreSQL │ │ |
| 186 | +│ │ - Redis │ │ |
| 187 | +│ └──────────────────────────┘ │ |
| 188 | +└─────────────────────────────────┘ |
| 189 | +``` |
| 190 | + |
| 191 | +**Key Difference:** Coder uses a **single container** with everything pre-configured. Local uses **multiple containers** orchestrated by docker-compose. |
| 192 | + |
| 193 | +--- |
| 194 | + |
| 195 | +## 🤝 Team Recommendations |
| 196 | + |
| 197 | +- **Onboarding**: Start with Coder (faster, no local setup) |
| 198 | +- **Daily Development**: Use Coder (consistent environment) |
| 199 | +- **Offline Work**: Use local devcontainer |
| 200 | +- **Custom Experiments**: Use local devcontainer |
| 201 | + |
| 202 | +--- |
| 203 | + |
| 204 | +## 📚 Additional Resources |
| 205 | + |
| 206 | +- [Coder Documentation](https://coder.com/docs) |
| 207 | +- [VS Code Devcontainers](https://code.visualstudio.com/docs/devcontainers/containers) |
| 208 | +- [SimpleAccounts Coder Setup](.coder/README.md) |
| 209 | +- [Devcontainer Config](.devcontainer/README.md) |
0 commit comments