|
| 1 | +# JabRefOnline Development Instructions |
| 2 | + |
| 3 | +JabRefOnline is a modern Nuxt.js web application serving as the homepage for JabRef (https://www.jabref.org/). It's built with Vue.js, TypeScript, GraphQL, Prisma, PostgreSQL, and Redis, featuring a complete full-stack architecture with database management, authentication, and content management. |
| 4 | + |
| 5 | +**Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.** |
| 6 | + |
| 7 | +## Working Effectively |
| 8 | + |
| 9 | +### Initial Setup |
| 10 | + |
| 11 | +PostgreSQL and Redis services are automatically provided with pre-configured environment variables in the Copilot environment. The database is already created and seeded. |
| 12 | +The dependencies are already installed. |
| 13 | + |
| 14 | +### Build and Development Commands |
| 15 | + |
| 16 | +**CRITICAL - Build Timeouts:** |
| 17 | + |
| 18 | +- **NEVER CANCEL** build commands. Set timeout to 120+ minutes. |
| 19 | +- Build takes 45-60 seconds normally but can take longer on first run. |
| 20 | +- Always wait for builds to complete fully. |
| 21 | + |
| 22 | +```bash |
| 23 | +# Development server (NEVER CANCEL - takes 30+ seconds to start) |
| 24 | +pnpm dev # Runs on http://localhost:3000 - TIMEOUT: 120+ seconds |
| 25 | + |
| 26 | +# Production build (NEVER CANCEL - takes 45-60 seconds) |
| 27 | +pnpm build # TIMEOUT: 120+ seconds |
| 28 | + |
| 29 | +# Production server (requires build first) |
| 30 | +pnpm start # Runs on http://localhost:3000 |
| 31 | +``` |
| 32 | + |
| 33 | +### Testing Commands |
| 34 | + |
| 35 | +**CRITICAL - Test Execution:** |
| 36 | + |
| 37 | +- E2E tests **REQUIRE** development server running first |
| 38 | +- Unit tests are independent and run quickly |
| 39 | +- **NEVER CANCEL** test suites. Set timeout to 60+ minutes. |
| 40 | + |
| 41 | +```bash |
| 42 | +# Unit tests only (fast, independent) |
| 43 | +pnpm test:unit # Takes ~11 seconds |
| 44 | + |
| 45 | +# E2E tests (REQUIRES dev server running in separate terminal) |
| 46 | +# Terminal 1: pnpm dev (keep running) |
| 47 | +# Terminal 2: |
| 48 | +export TEST_URL="http://localhost:3000" |
| 49 | +pnpm test:e2e # Takes ~13 seconds |
| 50 | + |
| 51 | +# Integration tests |
| 52 | +pnpm test:integration # Takes ~15 seconds |
| 53 | + |
| 54 | +# All tests (some will fail if dev server not running) |
| 55 | +pnpm test # Takes ~13 seconds - TIMEOUT: 60+ seconds |
| 56 | +``` |
| 57 | + |
| 58 | +### Quality Assurance Commands |
| 59 | + |
| 60 | +```bash |
| 61 | +# Linting (comprehensive check) |
| 62 | +pnpm lint # Takes ~30 seconds - warnings expected, no errors |
| 63 | + |
| 64 | +# Type checking |
| 65 | +pnpm typecheck # Takes ~22 seconds |
| 66 | + |
| 67 | +# GraphQL validation |
| 68 | +pnpm validate # Takes ~1.5 seconds |
| 69 | +``` |
| 70 | + |
| 71 | +### Additional Development Tools |
| 72 | + |
| 73 | +```bash |
| 74 | +# Storybook UI components (NEVER CANCEL - takes 7+ seconds to start) |
| 75 | +pnpm storybook # Runs on http://localhost:6006 - TIMEOUT: 120+ seconds |
| 76 | + |
| 77 | +# Database visual editor |
| 78 | +pnpm prisma:studio # Runs on http://localhost:5555 |
| 79 | + |
| 80 | +# Database operations |
| 81 | +pnpm prisma:push # Push schema changes to dev DB |
| 82 | +pnpm prisma:migrate:dev # Create and apply new migration |
| 83 | +``` |
| 84 | + |
| 85 | +## Workflows |
| 86 | + |
| 87 | +**Database Schema Development Workflow:** |
| 88 | + |
| 89 | +1. **Prototyping Phase:** |
| 90 | + |
| 91 | + ```bash |
| 92 | + # Make changes to server/database/schema.prisma |
| 93 | + pnpm prisma:push # Push changes to database (no migration) |
| 94 | + # Iterate and test changes |
| 95 | + ``` |
| 96 | + |
| 97 | +2. **Migration Creation:** |
| 98 | + ```bash |
| 99 | + pnpm prisma:migrate:dev # Generate migration file from schema changes |
| 100 | + pnpm prisma:seed # Re-seed if needed |
| 101 | + ``` |
| 102 | + |
| 103 | +**GraphQL Development:** |
| 104 | + |
| 105 | +- Schema located at `server/schema.graphql` |
| 106 | +- Resolvers in `server/resolvers.ts` |
| 107 | +- Generated types automatically updated on file changes |
| 108 | +- GraphQL endpoint: `http://localhost:3000/api` |
| 109 | + |
| 110 | +## Validation Scenarios |
| 111 | + |
| 112 | +**ALWAYS manually validate changes using these complete user scenarios:** |
| 113 | + |
| 114 | +### Scenario 1: Basic Homepage Functionality |
| 115 | + |
| 116 | +1. Start development server: `pnpm dev` |
| 117 | +2. Navigate to http://localhost:3000 |
| 118 | +3. Verify homepage loads with "Stay on top of your Literature" heading |
| 119 | +4. Test navigation: click "Features" link |
| 120 | +5. Verify page scrolls to #features section |
| 121 | +6. Check browser console for critical errors (warnings are expected) |
| 122 | + |
| 123 | +### Scenario 2: Full Development Workflow |
| 124 | + |
| 125 | +1. Make code changes to components or pages |
| 126 | +2. Verify that it works in the browser |
| 127 | +3. Run unit tests: `pnpm test:unit` |
| 128 | +4. Test E2E with dev server running: `pnpm test:e2e` |
| 129 | + |
| 130 | +### Scenario 3: Production Build Validation |
| 131 | + |
| 132 | +1. Build application: `pnpm build` |
| 133 | +2. Start production server: `pnpm start` |
| 134 | +3. Verify application loads correctly |
| 135 | +4. Test key navigation and functionality |
| 136 | + |
| 137 | +## Technology Stack and Architecture |
| 138 | + |
| 139 | +- **Frontend:** Nuxt.js 4, Vue.js 3, TypeScript |
| 140 | +- **Styling:** Tailwind CSS, Naive UI components |
| 141 | +- **Backend:** Nuxt server API, GraphQL with Apollo |
| 142 | +- **Database:** PostgreSQL with Prisma ORM |
| 143 | +- **Cache:** Redis for session storage |
| 144 | +- **Testing:** Vitest for unit/integration/E2E tests |
| 145 | +- **UI Development:** Storybook for component development |
| 146 | + |
| 147 | +## Important Directory Structure |
| 148 | + |
| 149 | +``` |
| 150 | +/server/ # Backend API, GraphQL resolvers, database models |
| 151 | +/pages/ # Nuxt.js route pages |
| 152 | +/components/ # Vue.js reusable components |
| 153 | +/layouts/ # Page layout templates |
| 154 | +/content/ # Markdown content files |
| 155 | +/assets/ # Uncompiled assets (CSS, images) |
| 156 | +/public/ # Static files served directly |
| 157 | +/apollo/ # GraphQL client configuration |
| 158 | +/test/ # Test utilities and setup |
| 159 | +/.github/workflows/ # CI/CD pipeline configuration |
| 160 | +``` |
| 161 | + |
| 162 | +## Pre-commit Checklist |
| 163 | + |
| 164 | +Before committing changes, always run: |
| 165 | + |
| 166 | +1. `pnpm test:unit` - All unit tests must pass |
| 167 | +2. `pnpm build` - Must build successfully |
| 168 | +3. `pnpm lint` - Fix any errors, warnings are acceptable |
| 169 | +4. `pnpm typecheck` - Must pass without errors |
| 170 | + |
| 171 | +The CI pipeline (.github/workflows/ci.yml) will fail if linting, type checking, building, or core tests fail. |
| 172 | + |
| 173 | +## Development Servers and Ports |
| 174 | + |
| 175 | +- **Main application:** http://localhost:3000 (dev server) |
| 176 | +- **Storybook:** http://localhost:6006 (component development) |
| 177 | +- **Prisma Studio:** http://localhost:5555 (database management) |
| 178 | +- **Tailwind Viewer:** http://localhost:3000/\_tailwind/ (CSS utility viewer) |
| 179 | + |
| 180 | +Always ensure ports are available before starting services. The development server includes hot reload and will automatically reflect code changes. |
0 commit comments