GithubHelp home page GithubHelp logo

collec's Introduction

Collec: a collection tracker webapp

Mock-up of the frontpage showing on a number of different devices

Collec is a webapp for tracking several types of collections. It was originally made for Code Institute's 4th submission project.

A live version is deployed and available here.

Important notes

The documentation is split across three files:

  • README.md (this file): Overview of the app. Read this to get an idea of the premise of the app, technologies used and project conventions.
  • DESIGN.md: UX design notes crafting during early stages of development. The design process is described entirely, from the concept and market research, through information structuring to visual design principles and color palettes,
  • TESTING.md: The project was validated using automated tools, as well as tested with a manual testing procedure. These are documented in this file.

The project is managed via a GitHub project. Issues are created in a "User story" format, and assigned size/complexity and importance. Each issue contains a title, user story sentence, and a list of technical expectations.

Highlights

Screenshot of the landing page

The landing page is simple and to the point, cleanly explaining the purpose of the app.

Screenshot of the sign-up modal

The sign-in and sign-up screens are modals, with their content loaded from the server via AJAX.

Screenshot of the dashboard page

After signing in, the user can open their Dashboard which shows 5 most recently modified items from each collection. Item creation and editing is available from here as a shortcut.

Screenshot of the item list

Each collection can be viewed in detail, with sorting and search functionality.

Screenshot of the item editor modal

Items can be created, modified and deleted using the editor modal, loaded from the server like the sign-in/up ones.

Screenshot of the dashboard page in read-only mode

Opening a user's page without signing in as them enters read-only mode, allowing anyone to browse your collection.

Screenshot of the dashboard page on a mobile display

Every page is trivially responsive with wrapping UI elements and grids.

Technologies used

  • Python 3: Used for the backend portion of the app,
  • HTML5+CSS3: Design of the frontend,
  • Javascript (ES6): Interactive functionality and AJAX calls.

Dependencies

All dependencies are included, or installed via requirements.txt.

  • Django 4.1: backend framework used to serve the app to the browser and as a RESTful interface to manipulate the models,
  • Bootstrap 5: CSS framework for grid layout and improved based styles,
  • django-crispy-forms: Django library that improves form rendering,
  • django-allauth: Django library that expands on the built-in user authentication.

Deployment

Collec is a Django web-app, and is deployed via the standard Django procedures. A number of settings is exposed via environment variables, some of which must be set for the app to load:

  • COLLEC_SECRET_KEY: required. Must be set to any string, as long as it's kept secret. Make sure the key is not present in committed code, logs, etc.
  • COLLEC_DEBUG: if set, Collec will start in debug mode. Errors will be printed on the site, potentially exposing sensitive information. Use only for debugging and development.
  • COLLEC_HOST: required if COLLEC_DEBUG is not set. Hostname that will be used to access the site, such as collec.example.com. Accesses from any other source will be denied.

Deployment example

Collec can be deployed via a number of methods - to a dedicated server, application platform such as S3 or Heroku, a Docker container, etc. The instance above was deployed to a virtual environment (venv) in a dedicated server. The procedure will be detailed below for reference.

Prerequisites:

  • Server is running a Linux distribution with systemd,
  • Nginx is installed and running,
  • PostgreSQL is installed and running.
  1. Navigate to the destination folder that will store the application, such as /srv/http,
  2. Clone the repository:
    git clone https://github.com/Tearnote/collec
    
  3. We need to set up a virtual environment for Python. Enter the cloned project, and create a fresh virtualenv:
    python -m venv venv
    
  4. Activate the virtual environment in current shell. This should add (venv) to your visible command line:
    source venv/bin/activate
    
  5. Dependencies can now be installed with the following command:
    pip install -r requirements.txt
    
  6. The dependencies include Gunicorn and Psycopg2, which will be required for a production deployment. Gunicorn will need to be configured separately to match your deployment. An example configuration file is included here. Copy this to the root folder of the project, and customize it with your server's paths.
  7. We will now configure the database. Collec is by default configured to use a Sqlite database file, which is only suitable for a test deployment with few concurrent users. Configure your Postgres connection in collec/settings.py. An example commented-out configuration is included.
  8. The database and user needs to be created on Postgres side. These example commands will configure the database for use, customize them to match your deployment:
    sudo -u postgres psql
    create database collec;
    create user collec with password 'collec';
    alter role collec set client_encoding to 'utf8';
    alter role collec set default_transaction_isolation to 'read committed';
    alter role collec set timezone to 'UTC';
    grant all privileges on database collec to collec;
    \q
    
  9. Now, you should be able to connect to the database to create all the required tables. Navigate to the project folder, activate the venv again if needed (step 4.), and run the following commands:
    # Temporarily set all the env vars required for the project to run
    export COLLEC_SECRET_KEY=yoursecretkey
    export COLLEC_HOST=collec.example.com
    export COLLEC_POSTGRES_PASSWORD=yourpassword
    
    python manage.py makemigrations
    python manage.py migrate
    
  10. Optionally, you might want to configure Collec as a systemd service so that it's started automatically. An example systemd unit file is available here. Customize the file with your credentials and paths, drop it into /etc/systemd/system/, and run these commands to reload unit files and start Collec:
    sudo systemctl daemon-reload
    sudo systemctl start collec
    
    If the unit doesn't start correctly, look for errors in the system journal and the Gunicorn log file as configured in gunicorn.conf.py (step 6.)
  11. The app is now running, and it's time to expose it to the world via Nginx reverse proxy. This needs to be configured to match your domain name, serving methods and SSL setup, among others. You can find an example Nginx configuration file here, which needs to be customized with domain names and local paths. The file assumes the app is hosted on localhost:8001, which matches the example Gunicorn configuration file.
  12. You should be able to view the app via its URL, but the styles and images will not work. For that, static files must be hosted via Nginx. Collect all static files by navigating to the project folder, activating the venv (step 4.), and running the following command:
    python manage.py collectstatic
    
    This will copy all static files into the static folder in the project. The default Nginx configuration will serve these files directly.

Bugs

A few issues were not able to be fixed by submission date, they are detailed below.

  • Bad handling of invalid sign-in and sign-up details
    If wrong details are provided into the sign-in/up modals, the user will be redirected to a style-less page where the error is shown to them and they can try again. Although the page looks incomplete, the form is still functional.
    This is caused by the default Django-allauth views returning HTTP 200 on sign-in/up failure, so it cannot be caught by the Javascript making the AJAX request from the modal to update only the modal's HTML instead of the whole document. This is fixable by customizing the view, so that failures return an HTTP error code. I was not able to resolve this by submission date.
  • Missing interactivity hints
    When items are added or modified, a good design practice is to display pop-ups to the user confirming the change. This was not implemented in time for submission. Thankfully, the item lists display the most recent items by default, so the user's change is still visible to them at the top of the page.
  • No pagination
    All item views currently show all items, which might be slow with a great deal of items on the account. To support larger collections, pagination or infinite scroll should be introduced.

Credits

Landing page photo by Emily

collec's People

Contributors

tearnote avatar

Watchers

 avatar

collec's Issues

User settings

As a user, I want to have a settings page where I can disable features of the site I don't need so that I can customize my experience and reduce clutter.

  • User can open a settings modal from the Dashboard
  • The modal allows disabling of collection types

User sign-up

As a visitor, I want to sign up so that I can start tracking my collections.

  • Landing page contains a "Sign up" button
  • When clicked, the button opens the sign-up modal
  • Sign-in modal has a button to switch to the sign-up modal
  • The modal contains a form to create a new account
  • Fields are validated, the password checked against a list of security requirements
  • A successfully created account can be used to sign-in

Landing page

As a visitor, I want to see a landing page so that I know what the product is about.

  • The root URL opens the landing page
  • The landing page is a static page containing product details

User dashboard

As a registered user, I want to be presented with a dashboard view to see the state of my collections at a glance.

  • After sign-in, user is redirected to their dashboard page
  • The dashboard contains a list of the user's collections for quick navigation
  • The dashboard also lists the most recently modified items from each collection

Item list sorting

As a user I want to sort my items so that I can see which items excel in some particular way.

  • Item list contains a dropdown with all of the collection's fields
  • Next to the dropdown is an arrow button, which toggles between up and down arrow and controls if the sorting order is ascending or descending
  • This reorders items in the list according to the value in the selected field

Item list search

As a user I want to search my collections to get to an item I'm looking for instantly.

  • Item list has a search box
  • Search goes through all text-based fields and removes entries that don't match the search term from the list
  • Pressing the "x" on the search field clears the search and restores the view, showing all items again

Inline help

As a user I want to be able to read more about site features so that I never feel confused about the interface.

  • Every major modal and section has a "?" button
  • Clicking this button shows a pop-up with detailed help about the visible elements

User sign-in

As a user, I want to sign in to get access to my data.

  • Landing page has a "Sign in" button
  • Clicking the button shows a modal with the sign-in form
  • User details are validated against the user database
  • If sign-in is successful, the button is replaced with the username and "Sign out" button
  • Clicking the "Sign out" button reverts back to the initial state

Data export

As a user I want to be able to export my collections to a file so that I'm not afraid of losing my data.

  • An "Export" button turns all user data into a JSON file and offers it for download

Profile comments

As a user I want to comment on my friends' profiles so that we can chat about our collections.

  • When on the dashboard of a mutual friend, a comment box is visible
  • A comment section with all submitted comments is visible on the dashboard
  • The account owner can delete submitted comments that they don't approve of

Data import

As a user I want to be able to import my collections to continue tracking on a different site instance.

  • An "Import" button is available, which allows the user to upload a previous export
  • If the user already has collections with the same name as in the import, the collections are replaced with imported ones

Grid view

As a user I want to customize how the list layout to find the best fit for my collections.

  • Item views can be switched between list mode (default) and grid mode
  • Grid mode shows items in multiple columns instead of from top to bottom
  • Grid mode allows for showing image-type fields as background

Item list

As a user I want to list my collection items to make changes and additions.

  • Clicking a collection in the dashboard opens the item list modal
  • The modal lists all items in the collection

Item tags

As a user I want to be able to tag items so that I can sort and filter by various characteristics without adding new fields.

  • In collection editor, there is a checkbox to enable tag support for the collection
  • If enabled, any number of arbitrary tags can be added and removed from an item in item editor

External service import

As a user I want to import data from another tracker I was using so that I don't have to redo all the work.

  • "Import external" button is available, which allows the user to upload a file exported from a different website
  • The import will replace the collection of the matching type with the items from the service

Public dashboard

As a visitor, I want to view a different user's dashboard to browse their collections.

  • When unauthenticated, a user's dashboard opens in read-only mode

Private messaging

As a user I want to message my friends to discuss our collections privately.

  • A private message modal is available from the dashboard
  • The button also shows a badge for any incoming messages
  • The modal shows all conversations
  • A new conversation can be started by clicking a friend's name

Image upload

As a user I want to represent my items with images to make browsing my collection more enjoyable.

  • An image-type field can be added to a collection
  • This field is completed by uploading an image in the item editor
  • The image is reencoded and resized if needed to keep filesize small

Social media sign-up

As a visitor, I want to start using the website with an existing social media account so that getting started takes as little effort as possible.

  • On the sign-up modal, additional buttons are available to sign up via Google/Facebook/Twitter/etc.
  • This creates a new account which is linked via OAuth
  • On the sign-in modal, the same buttons allow for logging in via the social media account

Content catalogue autofill

As a user I want to autofill my item fields so that I don't have to type in all data automatically.

  • Some collection types support a content catalogue, such as MusicBrainz or Discogs
  • This enables autocomplete for item name
  • When an autocomplete suggestion is chosen, other matching fields are filled in as well

Item editor

As a user I want to be able to add and modify items to keep my collection up to date.

  • Item list has an "Add" button, and a "Modify" button next to each item
  • Pressing this button open the item editor modal
  • The modal contains an editable form showing all fields of the collection
  • Pressing the "Save" button commits the changes to the item

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.