The structure
βββ ποΈ Project
βββ π`api` *
βββ π`app` *
βββ π`components` *
βββ π`database` *
βββ π`lib` *
βββ π`utils` *
βββ π`features`
βββ πproducts
βββ π`components`
βββ π`database`
βββ πsales
βββ π`components`
βββ πusers
βββ π`lib`
βββ π`database`
Replicate the global structure *
inside each of the features/
as per required. (Above, the folders are highlighted, any keyword kind of folders are covered in back-ticks, like `this`)
Create only those folders that you are using (like an opt-in solution).
Glue together all the components (from the features/
) into the app
directory.
{
"extends" : [ "next/core-web-vitals" , "next/typescript" ],
"plugins" : [ "boundaries" ],
"settings" : {
"boundaries/include" : [ "src/**/*" ],
"boundaries/elements" : [
{
"mode" : "full" ,
"type" : "shared" ,
"pattern" : [
"src/components/**/*" ,
"src/data/**/*" ,
"src/drizzle/**/*" ,
"src/hooks/**/*" ,
"src/lib/**/*" ,
"src/server/**/*"
]
},
{
"mode" : "full" ,
"type" : "feature" ,
"capture" : [ "featureName" ],
"pattern" : [ "src/features/*/**/*" ]
},
{
"mode" : "full" ,
"type" : "app" ,
"capture" : [ "_" , "fileName" ],
"pattern" : [ "src/app/**/*" ]
},
{
"mode" : "full" ,
"type" : "neverImport" ,
"pattern" : [ "src/*" , "src/tasks/**/*" ]
}
]
},
"rules" : {
"boundaries/no-unknown" : [ "error" ],
"boundaries/no-unknown-files" : [ "error" ],
"boundaries/element-types" : [
"error" ,
{
"default" : "disallow" ,
"rules" : [
{
"from" : [ "shared" ],
"allow" : [ "shared" ]
},
{
"from" : [ "feature" ],
"allow" : [
"shared" ,
[ "feature" , { "featureName" : "${from.featureName}" }]
]
},
{
"from" : [ "app" , "neverImport" ],
"allow" : [ "shared" , "feature" ]
},
{
"from" : [ "app" ],
"allow" : [[ "app" , { "fileName" : "*.css" }]]
}
]
}
]
}
}