A simple Kanban board application using Flask and SQLite.
- Running Locally
- Overview
- Project Structure
- How It Works
- Safe Code Modifications
- Database Requirements
- Integrating Into Other Projects
- License
The application can be run with the following steps:
-
Install required python packages:
pip install -r requirements.txt
Note: this will install packages globally. To avoid changing the system packages, the venv module can be used to set up a virtual environment.
-
Run the application using
flask
:FLASK_APP=main.py flask run
-
Finally, connect to http://127.0.0.1:5000/ in a web browser.
This is a simple Kanban board application built using Flask and SQLite. The application allows users to create, update, delete, and reorder cards within predefined columns on a Kanban board.
The project consists of three main files:
main.py
– The core application logic and route definitions.cards.py
– The model and functions for managing Kanban cards.database.py
– Handles the database instance using SQLAlchemy.
This file sets up the Flask application and handles routes for card management.
- Routes:
/
: Return Kanban board index page/static/<file:path>
: Return static files from thestatic
directory (CSS, JS etc)/cards
: Returns all cards in JSON format./columns
: Returns available columns./card
: POST endpoint to create a new card./card/<int:card_id>
: PUT to update or DELETE to delete a card./card/reorder
: POST to reorder cards within the board.
This file contains the Card model and its associated functions. It includes creating, updating, deleting, and reordering cards.
- Key Functions:
all_cards()
: Fetch all cards, sorted bysort_order
.create_card()
: Create a new card with optional fields like color and column.update_card()
: Update an existing card's attributes.delete_card()
: Delete a card.order_cards()
: Reorder a card in the list.
The Card model is defined with attributes like id
, text
, column
, color
, modified
, archived
, and sort_order
. Cards are uniquely identified by id
, and columns specify the status of a card.
This file initializes the SQLAlchemy instance and connects to an SQLite database. The configuration is flexible to accommodate different databases as needed.
id
: Unique identifier for each card (primary key).text
: The content of the card (free text).column
: Defines which column the card belongs to (predefined options).color
: Color of the card, in#RRGGBB
format.modified
: Auto-updated timestamp when a card is modified.archived
: Boolean indicating if a card is archived.sort_order
: Determines the order in which cards are displayed in each column.
- The
id
field must be unique. - Ensure the
column
value is valid (exists in the list of predefined columns set by thekanban.columns
config option).
The application uses SQLite managed through SQLAlchemy. The main table Card
includes the following columns:
Column | Type | Description |
---|---|---|
id | Integer (PK) | Primary key for each card |
text | String(120) | The card's content |
column | String(120) | The card's column (e.g., "To Do", "Done") |
color | String(7) | Color code in #RRGGBB format |
modified | DateTime | Last modification timestamp |
archived | Boolean | Indicates if the card is archived |
sort_order | Integer | Order of the card within the column |
To integrate this Kanban board into another project:
Ensure Flask and SQLAlchemy are installed. You can use the following:
pip install flask sqlalchemy
Ensure that the SQLALCHEMY_DATABASE_URI
in your project points to a valid database:
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///your_project.db'
Integrate the Card
model and the routes from main.py
.
With the exception of the following, all code in this repository is released under the terms of the GNU General Public License v3:
- Plus and Edit icons were created by Andrian Valeanu, and are available under the Creative Commons (CC BY-NC 3.0) license.
- Vue.js is released under the MIT License.
- DragDropTouch is released under the MIT License.