-
Notifications
You must be signed in to change notification settings - Fork 2
Local Setup
Alexandra Swart edited this page Mar 5, 2019
·
1 revision
# ./server/
$ npm install
Create an .env file in the server directory which will be updated during setup. See also ./server/.env_example.
# ./server/.env
NODE_ENV=development
APP_SECRET=my-super-secret
HOST=http://localhost
PORT=4242
DEV_CLIENT_URL=http://localhost:7272
PROD_CLIENT_URL=
PROD_SERVER_URL=
CLOUDINARY_API_KEY=
CLOUDINARY_PRESET=nextstore
CLOUDINARY_SECRET=
PRISMA_DEV_ENDPOINT=
PRISMA_PROD_ENDPOINT=
PRISMA_SECRET=
STRIPE_SECRET=
MAILTRAP_HOST=
MAILTRAP_PORT=
MAILTRAP_USER=
MAILTRAP_PASS=
POSTMARK_HOST=
POSTMARK_PORT=
POSTMARK_USER=
POSTMARK_PASS=
- Create and access your Cloudinary account.
- Grab your API key (CLOUDINARY_API_KEY) and API secret (CLOUDINARY_SECRET) from the main console page.
- Create a folder where uploads will be stored.
- Add an upload preset to set the dimensions uploaded files will be transformed into. (CLOUDINARY_PRESET)
- Create or access your MailTrap account.
- Create a demo inbox and check the SMTP Settings page for the Host, Port, Username, and Password credentials to be used in your env file.(MAILTRAP_HOST, MAILTRAP_PORT, MAILTRAP_USER, MAILTRAP_PASS)
(Postmark setup is unnecessary for local)
- Create or access your Prisma account.
- Globally install prisma then login to prisma in the terminal.
# ./server/
$ npm install -g prisma
$ prisma login
- Set up Prisma by using the prisma-cli in the terminal to generate your endpoint.
# ./server/
$ prisma init
# ? Set up a new Prisma server or deploy to an existing server?
> Demo server
# ? Choose the region of your demo server
# (for me it was 'answart/demo-us1')
> PRISMA-WORKSPACE/PRISMA-SERVER
# ? Choose a name for your service
> next-store-dev
# ? Choose a name for your stage (dev)
> dev
# ? Select the programming language for the generated Prisma client
> Don\'t generate
It will generate the files datamodel.graphql and prisma.yml.
-
Place the endpoint url from the generated prisma.yml as the PRISMA_DEV_ENDPOINT in your .env file. Delete the generated files as the endpoint is now in the .env file and generated files are already configured in the prisma directory.
-
Run the deploy script. Any changes from this point on can be deployed with the following script:
$ npm run deploy:dev
TODO
# ./client/
$ npm install
Update config file variables with the environment variables set in ./server/.env with the same name.
# ./client/config.js
# ...
export const PROD_SERVER_URL = 'PUTHERE';
export const CLOUDINARY_API_KEY = 'PUTHERE';
export const CLOUDINARY_PRESET = 'PUTHERE';
export const CLOUDINARY_SECRET = 'PUTHERE';
export const STRIPE_API_KEY = 'PUTHERE';
# ...
# ./server/
$ npm run start:dev
# ./client/
$ npm run start:dev
View app at localhost:7272 when both client and server are running.