# Getting Started ## Create .env.local file Before starting make sure .env.local file exists and contains ```bash # Only needed if using keycloak NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET= # you can generate it using "openssl rand -base64 32" # If you plan to use keycloak (only openid issuer implemented) you have to create a client on your app KEYCLOAK_CLIENT_ID=... KEYCLOAK_CLIENT_SECRET=... KEYCLOAK_ISSUER=https:///realms/ ``` ## Launch development server First, run the development server: ```bash npm ci npm run dev ``` Or use another package manager Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. # Add features ## Add page Create src/app/[locale]/{your-page}/page.tsx Or src/app/{your-page}/page.tsx if you don't want to use locales Add your code and there you go ! ## Add API endpoint Create src/app/api/your/endpoints/route.ts or src/app/api/your-endpoints/route.ts ## Add Locale Copy messages/en.json and rename it messages/{your-locale}.json, then translate it. Add locale flag at svg format in public/flags Update src/i18n/routing.ts with your new locale # Protect a Page route or an API route Add your Page or API in src/proxy.ts ```typescript '/example': ['admin'], # Page only accessible to users with admin role '/dashboard': [], # Page accessible to all users connected ``` # Git ## Before Commit ### Setup If you use this template by using git clone, remove .git and link directory to a repo Then run ```bash git init git remote add origin https://gitea.iceberg.black/user/repo.git git branch -M main git push -u origin main ``` ### Lint and format Install Husky to link and format code before commit ```bash npx husky init ``` Copy ```bash npx lint-staged ``` Or whatever you want in .husky/pre-commit ### Project related informations Change all lines with [TO CHANGE] + public/manifest.json ## Before Push - Ensure all git secrets or variables exist - Ensure all docker links exist on distant machine - Ensure env file exists on remote machine. If client needs access to env var put it in .env.production so var in included at build (DONT PUT SECRETS). ## Auto deploy To run auto deploy you have to check for the "Before Push" section and then: Push Tag with format v\* to trigger Deploy CI ```bash git tag -a vX.X.X -m "Release vX.X.X" # Locally git push origin vX.X.X # On remote ``` Optionnal Delete tag: ```bash git tag -d vX.X.X # Locally git push origin :refs/tags/vX.X.X # On remote ``` Useful command with all to reset ```bash git tag -d v1.0.0; git push origin :refs/tags/v1.0.0; git tag -a v1.0.0 -m "Release v1.0.0"; git push origin v1.0.0 ``` # Features ## Implemented - Clean gitea CI - Locale handling - Authentification with keycloak - Routes an API role protections - Auto deploy ## To implement - Token refresh - No error when streaming with too large model - Translations - When user stop generation, forward it to server - Message UI - UX (eg keep focus when press enter)