Skip to content

a full-stack application for exploring campsites in the US and Canada

Notifications You must be signed in to change notification settings

cverish/campsites-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Campsites App

Background

A full-stack application for exploring public campsites across the US and Canada.

The app currently contains a filterable list view of all campsites with server-side filtering, sorting, and pagination. It's also mobile-friendly! More features to come, go to the Project Status section for more details.

View the work-in-progress application here.

Table of Contents

Technologies

Server: python

  • Postgres database (with sqlalchemy ORM)
  • API using FastApi
  • Docker

Front-end:

  • React with TypeScript
  • Mantine component library
  • react-query for asynchronous data management

Setup

Installations:

Verify these installs by running

$ docker --version
$ npm --version

Running the application

Server

In the root directory, run

$ make build
$ make start

to build and start the backend services.

You will need to manually run the alembic migration (on the list to fix):

$ make bash
$ make db-upgrade

After doing so, you may need to restart the docker services.

The API is accessible at localhost:8000. To view the Swagger docs, visit localhost:8000/docs in your browser.

Data can be uploaded via the /campsites/upload endpoint; CSV data files can be found in /campsites_db/data. The data in these CSVs has been very mildly cleaned from the source data, so I recommend you use these files.

Client

Within the /client folder, run

$ make init

This will copy the contents of .env.template into .env.local and install the node_modules. You'll need to change the values in .env.local to be specific to your setup -- local development values are specified in the template.

To run the application locally:

$ npm start

Once it is running, visit localhost:3000 in your browser to view the application.

Development

Once the docker container is running, changes to files in /server will be synced automatically -- no need to rebuild during development. However, you will need to docker exec into the docker container (via make bash) to apply alembic migrations.

To interact directly with the postgresql database, ensure you have, at a minimum, psql installed:

$ psql --version

If you do not, you can install it via the installer or manually via brew:

$ brew install postgresql

(or for the minimal version, libpq, but this requires more setup.)

Once you have verified installation, the following command will open a postgresql terminal, after which you will be prompted for a password:

$ psql -h 127.0.0.1 -p 5555 -d {database} -U {user}

In local development, database, user, and password are all postgres.

You can use

$ make psql-terminal

as a shortcut in local development; you will still be prompted for a password.

Testing

TODO

Project Status

This project is still a work-in-progress, with basic backend functionality completed and the frontend in active development.

  • backend
    • database containing campgrounds
    • basic endpoints
    • file upload
    • campsite list basic filtering and sorting
    • geolocation support
    • ability to create trips
  • frontend
    • list view
    • list filtering and sorting
    • detail page
    • map view
    • trip planner
  • infrastructure
    • apply alembic migration automatically in the docker container
    • more functional Makefile's
  • Good coding practices
    • tests
    • linting

Credits