This repository contains a simple web application for maintaining a personal journal. The application is built using Streamlit, a Python library for creating interactive web applications, and MongoDB, a NoSQL database. The web app allows users to add, modify, and delete journal entries, as well as filter entries based on date.
- Add new journal entries.
- Modify existing journal entries.
- Delete journal entries.
- Filter entries by date range.
- Display previous journal entries.
- 01-09-2023: Added authentication through streamlit-authenticator package.
- 27-09-2023: Added audio entries with transcription powered by openai's whisper.
To run the journal web app locally, follow these steps:
-
Clone this repository:
git clone https://github.com/yourusername/journal-webapp.git
-
Install the required rependencies:
(a) Using pip. Navigate to the project directory and run:
pip install -r requirements.txt
(b) Or using conda to run the code in a virtual environment. Navigate to the project directory and run:
conda env create -f environment.yml
Then to activate the newly created environment with name "journal", run:
conda activate journal
-
Ensure you have a MongoDB instance set up. You will need the connection URI.
-
Create a
.streamlit
directory in the root of your project (if not already present), and create asecrets.toml
file inside it. Add the following lines to thesecrets.toml
file, replacing<your-mongo-uri>
with your MongoDB connection URI, the configuration for authentification (check streamlit-authenticator documentation for more details):[mongo] uri = "<your-mongo-uri>" [credentials.usernames.jsmith] email = "jsmith@gmail.com" name = "John Smith" password = "abc" [credentials.usernames.rbriggs] email = "rbriggs@gmail.com" name = "Rebecca Briggs" password = "def" [cookie] expiry_days = 30 key = "random_signature_key" name = "random_cookie_name" [preauthorized] emails = [ "melsby@gmail.com" ]
-
Run the Streamlit app:
streamlit run journal.py
-
The web app will open in your default web browser. You can now start adding and managing journal entries.
-
New Entry: Add a new journal entry by typing in the text area and clicking the "Add entry" button.
-
Filter by date: Use the sidebar to select a start and end date to filter entries within a specific date range.
-
Number of entries: Adjust the slider in the sidebar to select the number of entries you want to display.
-
Previous Entries: View a list of previous journal entries based on your chosen filters.
-
Modify Entry: Click the "Modify" button on a specific entry to edit its content. You can also delete the entry using the "Delete entry" button.
journal.py
: The main Streamlit application script that defines the UI and interaction logic.requirements.txt
: A list of required Python packages for running the web app.
-
This is a simple example project and may not include advanced features such as authentication, user accounts, or extensive error handling. Ensure to enhance the app's security and reliability before deploying it to production.
-
Make sure to keep your MongoDB connection string secure, especially in production environments.
I've written a blog post about the development of this journal web app. There I go into detail about using atlas MongoDB hosting and Streamlit Community Cloud to serve the webapp. Check it out for more details and insights:
Contributions are welcome! If you find any issues or want to add new features, feel free to create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.