Current version: 4.2.0. This app is in Beta for iOS and Android.
(https://key-conservation.herokuapp.com/) (Production Server)
(https://key-conservation-staging.herokuapp.com/) (Staging Server)
Feel free to use yarn ...
instead of npm run ...
, but make sure not to commit the yarn.lock
.
- Clone the repository:
git clone https://github.com/Lambda-School-Labs/key-conservation-be
. - Navigate to the directory:
cd key-conservation-be
. - Install PostgreSQL. See installation instructions below.
- Install the necessary dependencies:
npm install
. For Windows users, see specific build instructions below. - Create a new
.env
file using.env.example
as a template:cp .env.example .env
. - Fill out the
.env
. See the example file below. - Run the containerized service(s) (e.g. Postgres):
docker-compose up -d
. - Initialize the database:
npm run db:migrate
. - Seed the database:
npm run db:seed
. - Start the Node app:
npm run server
.
MacOS and Linux users can install Postgres via Homebrew, and Linux users can use apt
. Windows users will need to download the Postgres 11.5 installer from here, run the installer, and add the Postgres bin to the PATH environment variable.
- Run the Windows Powershell as administrator.
- Install build tools to compile native Node modules:
npm install -g windows-build-tools
. - Rerun
npm install
in a separate command prompt window.
AIRTABLE_KEY=
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_USER=keycons_dev
DATABASE_PASS=password
DATABASE_NAME=key-conservation
S3_ACCESS_KEY_ID=
S3_BUCKET_NAME=
S3_BUCKET_REGION=
S3_SECRET_ACCESS_KEY=
SWT_SECRET=secret
Note: For Windows users, localhost
won't work—you'll need to set DATABASE_HOST
to the Docker Machine's IP address.
docker-compose up -d
to configure and run any required servicesnpm install
to install the necessary dependenciesnpm run server
to run the Node app with Nodemonnpm run lint
to lint the Node app with ESLint (without--fix
)npm run lint:fix
to handle the simple linter issues automaticallynpm run test
to run the test suite with Jestnpm run db:migrate
to run any new database migrationsnpm run db:seed
to add some fake data to the databasedocker exec -it pg.keycons.local psql -U [DATABASE_USER] -d [DATABASE_NAME]
to access Postgres.
Take a look at package.json
for the actual commands.
https://documenter.getpostman.com/view/7671243/SVYtNdSZ?version=latest
The airtable key is stored in the config vars in heroku. To keep it secret in the front end, we access the key through a get request. The endpoint is /api/airtable, and the route is found in airtableRouter in the airtable-key-retrieval directory.
{
"id": INTEGER,
"sub": STRING,
"email": STRING,
"profile_image": STRING,
"created_at": TIMESTAMPTZ,
"location": STRING,
"mini_bio": STRING,
"species_and_habitats": STRING,
"twitter": STRING,
"facebook": STRING,
"instagram": STRING,
"phone_number": STRING,
"roles": STRING,
"admin": BOOLEAN,
"is_deactivated": BOOLEAN,
"deactivated_at": TIMESTAMP,
"strikes": INTEGER,
"full_text_weighted": TSVECTOR,
"accepting_help_requests": BOOLEAN
}
{
"id": INTEGER,
"user_id": FOREIGN KEY - "id" in USERS table,
"name": STRING,
"link_url": STRING,
"link_text": STRING,
"call_to_action": STRING,
"about_us": STRING,
"issues": STRING,
"support_us": STRING,
"city": STRING,
"country": STRING,
"point_of_contact_name": STRING,
"point_of_contact_email": STRING,
"longitude": DOUBLE,
"latitude": DOUBLE
}
{
"id": INTEGER,
"user_id": FOREIGN KEY - "id" in USERS table,
"name": STRING
}
{
"id": INTEGER,
"user_id": FOREIGN KEY - "id" in USERS table,
"created_at": TIMESTAMPTZ,
"image": STRING,
"name": STRING,
"description": STRING,
"call_to_action": STRING,
"urgency": STRING
}
{
"id": INTEGER,
"user_id": FOREIGN KEY - "id" in USERS table,
"campaign_id": FOREIGN KEY - "id" in CAMPAIGNS table,
"created_at": TIMESTAMPTZ,
"image": STRING,
"description": STRING,
"camp_name": STRING
}
{
"id": INTEGER,
"user_id": FOREIGN KEY - "id" in USERS table,
"campaign_id": FOREIGN KEY - "id" in CAMPAIGNS table,
"created_at": TIMESTAMPTZ,
"body": STRING
}
{
"id": INTEGER,
"campaign_id": FOREIGN KEY - "id" in CAMPAIGNS table,
"skill": ENUM_SKILLS,
"point_of_contact": STRING,
"welcome_message": STRING,
"our_contribution": STRING
}
{
"id": INTEGER,
"skilled_impact_request_id": FOREIGN KEY - "id" in SKILLED_IMPACT_REQUESTS table,
"user_id": FOREIGN KEY - "id" in USERS table,
"decision": ENUM_DECISIONS,
"why_project": STRING,
"relevant_experience": STRING
}
{
"id": INTEGER,
"user_id": FOREIGN KEY - "id" in USERS table,
"skill": ENUM_SKILLS
}
{
"id": INTEGER,
"goal_title": STRING,
"description": STRING,
"skilled_impact_request_id": FOREIGN KEY - "id" in SKILLED_IMPACT_REQUESTS table
}
{
"id": INTEGER,
"user_id": FOREIGN KEY - "id" in USERS table,
"campaign_id": FOREIGN KEY - "id" in CAMPAIGNS table,
}
{
"id": INTEGER,
"reported_by": FOREIGN KEY - "id" in USERS table,
"reported_user": FOREIGN KEY - "id" in USERS table,
"post_id": INTEGER,
"table_name": STRING,
"description": STRING,
"reported_at": TIMESTAMPTZ,
"is_archived": BOOLEAN
}
{
"id": INTEGER,
"connector_id": FOREIGN KEY - "id" in USERS table,
"connected_id": FOREIGN KEY - "id" in USERS table
}
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
If you are having an issue with the existing project code, please submit a bug report under the following guidelines:
- Check first to see if your issue has already been reported.
- Check to see if the issue has recently been fixed by attempting to reproduce the issue using the latest master branch in the repository.
- Create a live example of the problem.
- Submit a detailed bug report including your environment & browser, steps to reproduce the issue, actual and expected outcomes, where you believe the issue is originating from, and any potential solutions you have considered.
We would love to hear from you about new features which would improve this app and further the aims of our project. Please provide as much detail and information as possible to show us why you think your new feature should be implemented.
If you have developed a patch, bug fix, or new feature that would improve this app, please submit a pull request. It is best to communicate your ideas with the developers first before investing a great deal of time into a pull request to ensure that it will mesh smoothly with the project.
Remember that this project is licensed under the MIT license, and by submitting a pull request, you agree that your work will be, too.
- Ensure any install or build dependencies are removed before the end of the layer when doing a build.
- Update the README.md with details of changes to the interface, including new plist variables, exposed ports, useful file locations and container parameters.
- Ensure that your code conforms to our existing code conventions and test coverage.
- Include the relevant issue number, if applicable.
- You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
These contribution guidelines have been adapted from this good-Contributing.md-template.
See Key Conservation for details on the frontend of our project.