cp .env.example .env.development- Replace
.env.developmentwith variables from Aaron yarn dev- Open http://localhost:3000 in your browser.
Gotchas:
- Does the backend (
dna-admin) have menus, products, live streams - Do you have the backend url & api key in
.env?
Always use @emotion/styled wherever possible. If regular CSS is required, use one of the following style files.
We manage our global styles in several files:
./styles/global-styles.tsx(global stylesheet)./styles/fonts.css(global @font-face rules)./styles/all.css(global styles injected in at app root)./styles/theme.tsx(global theme variables)./emotion.d.ts(theme typings)
- The app has a "Maintenance Mode" (branded fullscreen takeover), simply set
IS_MAINT_MODE=true, and the<Header/>will disappear and<Home/>gets taken over by<ComingSoon/>. It's fun, try it! - All the data for the app comes in from our staging server on Heroku, but you can also run the dna-admin CMS+API locally (hint: login only works with a localhost API)
- To run against the local API, set the
SPREE_API_URLenvironment variable to the local API host/port - Complains about missing
.next/build-manifest.jsonare usually indications of anextbuild error. Try running$(npm bin)/next buildto see the exact error.
- Create pipeline in Heroku
- add Github repo
- Create app
- heroku buildpacks:add https://github.com/heroku/heroku-buildpack-nodejs -a app-name
- heroku buildpacks:add heroku/nodejs -a app-name
Unset all Heroku env vars:
heroku config:unset $(heroku config --shell | sed 's/=.*//' | xargs) -a app-name
POL Admin Interface & API http://dna-admin-dev.instinct.is/ http://dna-admin-staging.instinct.is/
POL Frontend Interface https://dna-frontend-dev.instinct.is/ https://dna-frontend-staging.instinct.is/
When there are lots of active changes occuring on this repo, make sure to regularly:
- Commit (or stash) your local changes on your branch
git fetch origingit checkout maingit pull origin maingit checkout <your_branch>git merge main- Fix merge conflicts (if any)
git add .git commit -m 'merge in latest main'
Done! …now you will be up-to-date with latest code. Do this before you submit your PR, and you can be sure it will be a clean merge.
https://localhost:8080/apidocs/swagger_ui#/
git remote add upstream git@github.com:1instinct/dna-frontend.gitgit fetch upstreamgit checkout maingit pull upstream main
cat .env.production | grep -v '^#' | xargs -L 1 heroku config:set -a dna-frontend-prod
- Move data fetching into on
getInitialProps - Setup Redux
Check out our Next.js deployment documentation for more details.
ssh clusterIPcd ./dna-frontendcp ./secret.example.yml ./secret.yml
Convert .env values to base64:
echo -n 'The seed of a powerful beginning' | base64 && \
echo -n 'hello@instinct.is' | base64 && \
...- It can be tricky, helps to use multiple cursors but:
- paste base64 values into
secret.yml microk8s kubectl apply -f secret.ymldocker build . -t localhost:32000/dna-frontend:registrydocker images(copy ID of newly built image)docker tag <image_id> localhost:32000/dna-frontend:registrydocker push localhost:32000/dna-frontend:registrymicrok8s kubectl rollout restart deployment/dna-frontend
-
Move data fetching into on
getInitialProps -
Setup Redux
-
Flow / Type Checking(TypeScript) -
React -
SSR(NextJS) -
State Mgmt(hooks/useContext... no Redux, yet) -
Request Mgmt(React Query) -
Search(Fuse.js) -
Pusher (real-time sockets)
-
Styled Components(@emotion/styled) -
Moving Letters
-
UI Sounds (proprietary: "npm install beeper")
-
Maps
-
File upload (ReactDropzone)
-
Form validation (Formik) -
Animations / Transitions (ReactSpring, GSAP)
-
Gestures
-
UI Alerts
-
Uptime Monitoring
-
Twilio
-
Unit Testing
-
Chat widget
-
RSS feeds
-
Chatbot (Rasa)
-
Masonry (react-responsive-masonry)
-
Browser Feature Detection
-
Speed/Performance Benchmarking (GTMetrix.com API?)
-
Header tags customization (NextJS:
next/header) -
Secrets management / Environment variables(dot-env)