This is an example repository for a monorepo style full-stack application based on NextJS for the frontend and FeathersJS as the API. The monorepo is setup with
- yarn2 workspaces
- nx (as a command runner and for the generators, could perhaps be replaced)
- typescript
By default the structure right now looks like the following:
/apps
----/api (featherjs)
----/web-client (nextjs)
/libs
----/components (react)
A shared component lib hosts created react components that can be used in other applications. The web-client imports a typed client from the api.
- run
yarn install
from the root - verify the mongodb connection string in /apps/api/config/default.json
Start the API with nx start api
or nx dev api
Generally any command specified in the scripts section of /apps/api/package.json
can be run using nx <command> api
The api is generated by a nx generator, thus normal nx commands can be used e.g. nx serve web-client
As nx is initialized, its generators can be used. By default @nrwl/next
and @nrwl/react
are installed as they
have been used to create the nextjs app and the component library.
You could for example generate a new component in the library with nx g @nrwl/react:component <ComponentName> --project components
(this assumes you have the nx cli installed globally).