https://github.com/madhusudanbabar/k-domains
A simple module to manage multiple subdomains with just one project
https://github.com/madhusudanbabar/k-domains
nuxt nuxt-module nuxtjs routing subdomain subdomains
Last synced: about 2 months ago
JSON representation
A simple module to manage multiple subdomains with just one project
- Host: GitHub
- URL: https://github.com/madhusudanbabar/k-domains
- Owner: madhusudanbabar
- License: mit
- Created: 2020-09-02T08:33:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-02T07:21:02.000Z (over 1 year ago)
- Last Synced: 2025-03-18T15:04:18.194Z (about 2 months ago)
- Topics: nuxt, nuxt-module, nuxtjs, routing, subdomain, subdomains
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/k-domains
- Size: 157 KB
- Stars: 52
- Watchers: 1
- Forks: 7
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Welcome to k-domains 👋
### 🏠 [Homepage](https://github.com/madhusudanbabar/k-domains#readme)
### ✨ Demo
[portfolio](https://madhusudan.live) & [blog](https://blog.madhusudan.live)## What is this ?? 🤔
> A simple nuxt module to manage multiple subdomains with just a single nuxtJS project## What problem does this solves??
Ever wondered how will you setup 3 sites of your own where you have same layouts & few shared components like feedback forms and so?? \
The simple way to do is copy, paste the same in all those 3 projects... isn't it?? \
But when you have to make changes, so you will require to copy the same thing in all the other projects... \
This is not the right way... ❌❌❌ \
***k-domains*** let's you manage any number of subdomains with ease and that too without even need to create separate project for each subdomain (site). All your layouts, shared components and the code for these sites will live in one project only. \
All you have to is to just add `k-domains` and configure it in your nuxt.config.js file as shown in the [#setup](#setup).## Install
```sh
yarn add k-domains # or npm i k-domains
```## Setup
1. Add ```k-domains``` to your project
```sh
yarn add k-domains # or npm i k-domains
```2. Add `@nuxtjs/router` to your project
```sh
yarn add @nuxtjs/router
```3. Configure ```k-domains``` and ```@nuxtjs/router``` to the buildModules section of `nuxt.config.js` as follows:
```js
export default {
buildModules: [
[ "k-domains", {
subDomains: [ ], // List of directories to hold te pages for your subdomains
rootDomain: "root-domain" // directory to hold the pages for root domain
}
],
["@nuxtjs/router",{
keepDefaultRouter: true // this line is mandatory...
}
]
]
}
```
4. Example
```js
export default {
buildModules: [
[ "k-domains", {
subDomains: ["blog", "projects", "anotherSubDomain" ], // List of directories to hold te pages for your subdomains
rootDomain: "main-domain" // directory to hold the pages for root domain
}
],
["@nuxtjs/router",{
keepDefaultRouter: true // this line is mandatory...
}
]
]
}
```
and the tree for the pages should look like this:
```
|
|─pages
| ├───blog
| ├───projects
| ├───main-domain
| └───anotherSubDomain
```5. That's it, now create pages in respective directories and it'll be mapped to that subdomains.
## Options
### `subDomains`
- Type: `Array`
Add your subdomains here### `rootDomain`
- Type: `String`
directory name for the pages of root-domain## Author
👤 **krypton < [email protected] >**
* Website: https://madhusudan.live
* Blog: https://madhusudan.live/blog
* Twitter: [@MadhusudanBabar](https://twitter.com/MadhusudanBabar)
* Github: [@madhusudanbabar](https://github.com/madhusudanbabar)
* LinkedIn: [@madhusudan-babar](https://linkedin.com/in/madhusudan-babar)## 🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/madhusudanbabar/k-domains/issues).## Show your support
Consider giving a ⭐️ if this project helped you!
***
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_