Comments (5)
Hi Alexi
Could you pl. let us know whether this feature is going to be released in near future? Is there possibility that the app. supports SSR?
Thanks
from angular-graphql-nestjs-postgres-starter-kit.
Hi @johannesschobel ,
I like the idea of a shared package between the client and the server, but I have a few concerns.
-
How would you include this shared package in the front-end build and then in the back-end build? As currently those are two separate processes and I would like to keep it like that. Maybe creating a private NPM package then importing it into both projects could work.
-
What if a dev wants to swap out the NestJS backend for a Java one? Then this shared package is only useful for the front-end.
-
Also, the argument is best to have a separation of concern between the BE and FE, or is it an anti-pattern?
What I would like to have eventually is a code generator that will generate boilerplate code like models, basic GraphQL queries and mutations, and FE code from a defined model/interface file. Something similar to how Liquibase manages a database from changelog files. This will avoid the need for developers to create and maintain boilerplate code like shared models and interfaces.
Thank you for your interest in the project.
Alexi Taylor
from angular-graphql-nestjs-postgres-starter-kit.
Dear @alexitaylor ,
thanks a lot for your reply and sharing your thoughts. Maybe you can look into narwal
to see how they try to solve this issue. Basically, they have apps
and libs
(shared "libraries") that are consumed from the apps. All parts (apps & libs) are built as dedicated npm packages
, and are bundled via lerna
. To be more precise, lerna
symlinks the packages internally as dependency - thats all.
For example, if your @app/frontend
package and your @app/backend
package both like to use the @app/models
package, you would add the latter as a dependency
in their package.json
file.. then you run something like lerna bootstrap
and lerna "magically" adds those dependencies to the npm_modules
of respective packages - thats all..
Regarding your points against it:
-
While this is a good idea - it only works if you have a "stable code base". For example, during the development process (within a "larger" team; people > 1), this results in a huge workload. Because you would need to change something, push it to git, push it to npm, the other needs to download it, and so on.. In development process this is a huge (!) issue, i think. Lerna, in turn, allows to separately push packages to npm if you would like to share those packages as independent modules as well..
-
that is true - but it would be in the case of developing a "shared package that is separately pushed to npm" as well.. However, you may need to think of those packages as a possibility to let other developers communicate with your api as well. The package (which contains, for example, interfaces for request / response objects) may be used by other devs as well.
-
SoC is good, yeah, but i don't see why you would violate this rule here?
All the best and thanks a lot for your time & effort!
from angular-graphql-nestjs-postgres-starter-kit.
Working on solution to use NX to create a shared libs
package for models/interfaces to be shared between the BE and FE.
Sent with GitHawk
from angular-graphql-nestjs-postgres-starter-kit.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
from angular-graphql-nestjs-postgres-starter-kit.
Related Issues (12)
- NPM install fails - bad github reference
- Upgrade from Angular 7 to 8
- Update NestJS from v5.x to v6.x HOT 1
- Client side error: .env has no default export HOT 4
- Implement Abstract Class Example HOT 3
- Migrate to .graphqlconfig HOT 1
- Uncaught Error: Unexpected value 'undefined' exported by the module 'SharedModule' HOT 1
- angular universal support HOT 2
- QueryFailedError: column cnst.consrc does not exist error when seeding/running server with Postgres12 HOT 2
- Dependency Dashboard HOT 2
- Action Required: Fix Renovate Configuration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-graphql-nestjs-postgres-starter-kit.