This repo is based on with-typescript-graphql and adds graphqhl subscriptions. If your project doesn't need subscriptions consider using the original repo.
$ npm ci
$ npm run build
$ npm start
$ npm run dev
Caution: To test the production version without ssl, you need to disable secure cookie:
$ COOKIE_SECURE=false npm start
As long as Apollo does not improve the on-the-fly change of credentials as well as the cleaning of data, especially hooks after a logout, it is necessary to reload the entire page in order to clean the data and also reset the connections with the new credentials :
// after login or logout mutation
document.location.reload()
Since WebSockets are not supported by most serverless providers, this type of project must be deployed on a hybrid stack:
-
A non-serverless infrastructure to manage only the websocket requests on a sub-domain:
<commit>.example.org
-
A serverless infra on the main domain, as can be done on Vercel:
example.org
Two modifications of the code are necessary to make it compatible with this hybrid stack:
-
Change the link from apollo websocket to subdomain:
wss://<commit>.example.org
-
Specify in the cookie returned by the frontend server the main domain, so that the cookie is sent to the subdomain:
example.org