Should a starter project go in a folder in a repo or the root?
Hi! I've been reading about vue and nuxt recently would like to give it a swing. But I got the most silliest and basic of questions.
I created a new github repo, nuxt-test-app and put a devcontainer in there. I opened the repo in a codespace and created the starter app using the vscode nuxtr extension. Now my repo structure looks like:
nuxt-test-app/.git/{git stuff}
nuxt-test-app/devcontainer.json
nuxt-test-app/readme.md
nuxt-test-app/nuxt-test-app/{nuxt starter stuff}
These seems wierd to me. Is this appropriately organized?
Thanks!
5 Replies
Hi @Bendezium. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
You're right to question that structure—it is not the typical or recommended way to organize a Nuxt project. The standard and recommended approach is to have your Nuxt project files (such as the app/ directory, nuxt.config.ts, package.json, etc.) directly in the root of your repository, not nested inside a subfolder.
A typical Nuxt project structure should look like this:
This matches the new default directory structure for Nuxt, where the main application code lives in the app/ directory at the root, and configuration files like nuxt.config.ts and package.json are also at the root level. There is no need for an extra nested folder containing the entire starter app inside your repo—this is likely an artifact of how you created the project, but it's not necessary or recommended for Nuxt projects. You can safely move the contents of the inner nuxt-test-app folder up to the root of your repository for a cleaner and more standard setup New Directory Structure.
This will also make it easier for tools, CI/CD, and other developers to work with your project, as they will expect the Nuxt app to be at the root.
If you want to see examples of minimal and recommended starter structures, check out the official Hello World example or the Minimal Starter template.
In summary:
Your Nuxt starter project should be at the root of your repository, not inside a subfolder. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Your Nuxt starter project should be at the root of your repository, not inside a subfolder. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@384788920669569044> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
If that's true, chatgpt lied to me 😛
@kapa.ai is it safe to just copy and paste it over or do i need to update some of the configuration files?
Let me check the knowledge base for you again. One moment! :books:
----------------------
If you move your Nuxt project files from a subfolder to the root of your repository, in most cases, it is safe to simply copy and paste the files. However, you should check if any configuration files reference paths that are now different due to the move. For example, if you have custom settings for directories (like srcDir, dir.app, dir.public, etc.) in your nuxt.config.ts, you may need to update those paths to reflect the new structure.
The Nuxt documentation explains that the default structure expects your app/ directory and configuration files at the root. If you had any custom configuration pointing to the old nested path, you should update those references after moving the files.
Also, if you use third-party tools or configs (like Tailwind CSS, ESLint, etc.), you may need to update their config files if they reference the old paths, as noted in the upgrade guide.
In summary:
- Move your files to the root. - Check and update any custom path references in nuxt.config.ts or third-party config files. - Most default setups will work without changes, but custom paths may need updating. If you haven't customized any paths, a simple copy-paste should be sufficient. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
- Move your files to the root. - Check and update any custom path references in nuxt.config.ts or third-party config files. - Most default setups will work without changes, but custom paths may need updating. If you haven't customized any paths, a simple copy-paste should be sufficient. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@384788920669569044> Kapa.ai is still learning and improving, please let me know how I did by reacting below.