Skip to content

open source project for the tech community - let's learn from each other

License

Notifications You must be signed in to change notification settings

upward-dev/Upward

Repository files navigation

heroku-next-postgres

This is a Next.js project bootstrapped with create-next-app.

Contributing

Technologies we use

If you want to use another type of package, please check with us on our slack channel

First, install the project dependencies with npm

Install the dependencies for the project with npm which is a shortcut for npm install. npm is a package manager that downloads packages from the npm Registry of open source packages that can help with many development tasks from compiling your React app so that it downloads faster for users to converting time between timezones or replacing words written in English into Spanish, Swahili, or Mandarin.

You'll need to run npm (or npm install) often to keep up to date with the npm packages other people may be adding to the project or updating to keep the site secure. You can't run npm too many times so don't worry about that; once a day is a good habit, and if the app won't start start for some reason running npm to make sure your dependencies are up to date is always the first step in troubleshooting to fix things.

Next, run the database migrations

Please refer to the local development document for details about how to get Docker running on your machine if you don't have it.

To create a local Docker container running your postgres instance, type:

npm run create-db

We use prisma as an ORM to postgres to connect directly to the database. See example in index.tsx

Download the prisma studio to connect directly to the heroku database:

For development: prisma will connect to your local Docker container

To update your database schema without generating a new migration (for prototyping data changes):

To generate and run all migrations:

npm run migrate-db

Finally, run the development server

Run npm run dev, then open http://localhost:3000 with your browser to see the result.

Where things are in the app

You can start editing the home page by modifying pages/index.js. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

Preparing for a Pull Request

TK note about mentors helping every step of the way as requested, invitation to ask lots of questions in Slack, read other people's code in code reviews, etc.....

All of these steps can be run in a single command: npm run ci-at-home if you want to know ahead of time if a pull request will pass the checks.

Linting Your Code

We use Prettier to keep the code uniform and easy to read following the StandardJS Styleguide . You can check if your code will pass our testing system's linting step by running npm run lint (which in turn runs npx prettier .). If the code doesn't pass you can fix many linting errors with npm run format (npx prettier --write).

On the Prettier website you'll find lots of information about plugins and extensions you can install for your text editor (we recommend Visual Studio Code) that will automate styling your code when you save or as you type, and don't forget about npm run format.

Creating a Pull Request on GitHub

Advanced Features

Typescript

Types Provided By NextJS

Alice: It's really difficult to use typescript half way.... I'm gonna have to think about this one

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Node Resources:

React Resources:

Styles

About

open source project for the tech community - let's learn from each other

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published