Clean Nuxt starter for real projects. REST-first. JWT-ready. No GraphQL.
- Nuxt 4 + Vue 3
- TypeScript strict mode
- Pinia state management
- Nuxt i18n:
en,uz,ru - Biome for lint + format
- Vitest + Nuxt Test Utils
- JWT auth helpers
- Typed REST API helper
- Lightweight Vue animations with VueUse Motion
- Docker production build
npm install
cp .env.example .env
npm run devOpen http://localhost:3000.
npm run dev # local dev
npm run build # production build
npm run preview # preview build
npm run typecheck # TypeScript check
npm run lint # Biome check
npm run lint:fix # Biome fix
npm run test -- --run
npm run check # typecheck + lint + testsNUXT_PUBLIC_SITE_URL=http://localhost:3000
NUXT_PUBLIC_API_BASE_URL=http://localhost:3000/api/v1
NUXT_PUBLIC_AUTH_LOGIN_PATH=/auth/login
NUXT_PUBLIC_AUTH_REFRESH_PATH=/auth/refresh
NUXT_PUBLIC_AUTH_ME_PATH=/auth/me
NUXT_PUBLIC_AUTH_LOGOUT_PATH=/auth/logoutUse useApi() for backend calls:
const api = useApi()
const users = await api.get<User[]>('/users')JWT token auto-attaches as Authorization: Bearer <token>. On 401, refresh token is tried once.
Files:
src/stores/auth.ts— login, refresh, logout, user statesrc/composables/useApi.ts— REST client with auth headerssrc/middleware/auth.ts— route protectionsrc/pages/login.vue— simple login page
Protect page:
definePageMeta({
middleware: ['auth']
})Expected login response:
{
"accessToken": "jwt-access-token",
"refreshToken": "jwt-refresh-token",
"user": {
"id": "1",
"email": "user@example.com"
}
}Snake case also works: access_token, refresh_token.
Locale files live here:
src/locales/en.jsonsrc/locales/uz.jsonsrc/locales/ru.json
Keep keys aligned in every locale.
Use VueUse Motion for lightweight UI animations:
<section
v-motion
:initial="{ opacity: 0, y: 24 }"
:enter="{ opacity: 1, y: 0, transition: { duration: 420 } }"
>
Content
</section>docker build -t nuxt-boilerplate .
docker run -p 3000:3000 --env-file .env nuxt-boilerplate- ESLint removed. Biome handles lint and format.
- GraphQL not included. Use REST endpoints.
npm auditcurrently reports0 vulnerabilities.