This is a boilerplate for starting Nuxt3 projects with Vite, TypeScript, ESLint, Tailwind CSS, Pinia and Docker.
useApi
.Before getting started, ensure you have the following installed:
v22.14
recommended)git clone https://github.com/mdotme/nuxt-starter my-awesome-project
cd my-awesome-project
pnpm i
.env.example
..env
:cp .env.example .env
.env
.eslint.config.mts
file../assets/css/tailwind.css
file.Sample flat project structure for Nuxt3. If your project is more complex and bigger than simple landing page consider using Nuxt layers.
Sample vue file:
<script setup lang="ts">
interface Props {
loading?: boolean; // Boolean props should be optional
}
const props = defineProps<Props>();
const emit = defineEmits<{
submit: [data: Record<string, any>];
}>();
// Project provided first
const { $api } = useNuxtApp();
const route = useRoute();
const { t } = useI18n();
const localePath = useLocalePath()
// Custom composables
const api = useApi()
// Stores
const authStore = useAuthStore() // Name just store if it's related to store like Login.vue
// Other stuff
const data = ref()
function sayHi() {
console.log("HII")
}
const getData = computed(() => data.value)
watch(data, () => {
console.log("Do something")
})
const
</script>
<template>...</template>
<style scoped>
...
</style>
Directories & Files:
/my-awesome-project
├── assets/
│ ├── css/
│ ├── fonts/
│ └── images/
│
├── composables/
│ ├── useApi.ts
│ ├── useApiFetch.ts
│
├── layouts/
│ ├── default.vue
│ └── auth.vue
│
├── middleware/
│ └── auth.global.ts
│
├── pages/
│ ├── index.vue
│ ├── login.vue
│ ├── register.vue
│ └── profile.vue
│
├── plugins/
│ └── api.ts
│
├── public/
│ └── favicon.ico
│
├── stores/
│ ├── auth.store.ts
│ └── user.store.ts
│
├── types/
│ ├── auth.types.ts
│ ├── common.types.ts
│ └── enums/
│ ├── roles.enum.ts
│ └── status.enum.ts
│
├── components/
│ ├── Auth/
│ │ ├── LoginForm.vue
│ │ └── RegisterForm.vue
│ └── User/
│ └── ProfileCard.vue
│
├── utils/
│ ├── sum.util.ts
│ └── format-date.util.ts
│
├── constants/
│ ├── maska.const.ts
│ └── regexes.const.ts
│
├── app.vue
├── error.vue
├── nuxt.config.ts
...
useCamelCase.ts
)kebab-case.ts
kebab-case.store.ts
with store suffixkebab-case.types.ts
with types suffixkebab-case.enum.ts
with enum suffixcomponents/
directory all must be Pascal/Case.vue
kebab-case.util.ts
with util prefixkebab-case.const.ts
with const prefixContributions are welcome! Please feel free to submit issues, feature requests, or pull requests.