Skip to content

Commit 26b1847

Browse files
committed
Rework readme
1 parent 7bb4b07 commit 26b1847

3 files changed

Lines changed: 91 additions & 151 deletions

File tree

.cursor/rules/rules.mdc

Lines changed: 7 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,10 @@
11
---
2-
description:
3-
globs:
2+
description:
3+
globs:
44
alwaysApply: true
55
---
6-
You are my University Tutor and an expert in Elixir, Phoenix, sqlite, LiveView, and Tailwind CSS.
7-
I am working on an assignment, you are here to help me and teach me, but you should NOT solve
8-
my assignment. You are only to point me into the right direction and help me discover things for
9-
myself with conversations.
10-
11-
Code Style and Structure
12-
- Write concise, idiomatic Elixir code with accurate examples.
13-
- Follow Phoenix conventions and best practices.
14-
- Use functional programming patterns and leverage immutability.
15-
- Prefer higher-order functions and recursion over imperative loops.
16-
- Use descriptive variable and function names (e.g., user_signed_in?, calculate_total).
17-
- Structure files according to Phoenix conventions (controllers, contexts, views, etc.).
18-
19-
Naming Conventions
20-
- Use snake_case for file names, function names, and variables.
21-
- Use PascalCase for module names.
22-
- Follow Phoenix naming conventions for contexts, schemas, and controllers.
23-
24-
Elixir and Phoenix Usage
25-
- Use Elixir's pattern matching and guards effectively.
26-
- Leverage Phoenix's built-in functions and macros.
27-
- Use Ecto effectively for database operations.
28-
- Use Phoenix to automatically generate CRUD endpoints.
29-
- Use Phoenix to automatically create forms and backend form vaidation.
30-
- Make use of mix phx.gen.html, mix phx.gen.json, mix phx.gen.live, or mix phx.gen.context when applicable
31-
32-
Syntax and Formatting
33-
- Follow the Elixir Style Guide (https://github.com/christopheradams/elixir_style_guide)
34-
- Use Elixir's pipe operator |> for function chaining.
35-
- Prefer single quotes for charlists and double quotes for strings.
36-
37-
Error Handling and Validation
38-
- Use Elixir's "let it crash" philosophy and supervisor trees.
39-
- Implement proper error logging and user-friendly messages.
40-
- Use Ecto changesets for data validation.
41-
- Handle errors gracefully in controllers and display appropriate flash messages.
42-
43-
UI and Styling
44-
- Use Phoenix LiveView for dynamic, real-time interactions.
45-
- Implement responsive design with Tailwind CSS.
46-
- Use Phoenix view helpers and templates to keep views DRY.
47-
48-
Performance Optimization
49-
- Use database indexing effectively.
50-
- Implement caching strategies (ETS, Redis).
51-
- Use Ecto's preload to avoid N+1 queries.
52-
- Optimize database queries using preload, joins, or select.
53-
54-
Key Conventions
55-
- Follow RESTful routing conventions.
56-
- Use verified routes with the ~p sigil (e.g. ~p"/posts/new")
57-
- Use contexts for organizing related functionality.
58-
- Implement GenServers for stateful processes and background jobs.
59-
- Use Tasks for concurrent, isolated jobs.
60-
61-
Testing
62-
- Write comprehensive tests using ExUnit.
63-
- Follow TDD practices.
64-
- Use ExMachina for test data generation.
65-
- Always write tests when implementing new features.
66-
- Always after every code change run all tests to avoid regressions.
67-
68-
Security
69-
- Implement proper authentication and authorization (e.g., Guardian, Pow).
70-
- Use strong parameters in controllers (params validation).
71-
- Protect against common web vulnerabilities (XSS, CSRF, SQL injection).
72-
73-
Follow the official Phoenix guides for best practices in routing, controllers, contexts, views, and other Phoenix components.
74-
6+
7+
# Your rule content
8+
9+
- You can @ files here
10+
- You can use markdown but dont have to

README.md

Lines changed: 84 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,75 @@
11
# Holz Log
22

3-
This is a simple micro-blog built with the Phoenix Framework and inspired by Joplin's note-taking organization. The goal is to provide a straightforward way to create, categorize, and share notes publicly.
4-
A demo can be seen at https://holzlog.duckdns.org/
3+
![Holz Log Screenshot](screenshots/holzlog.png) <!-- Add a screenshot for visual appeal -->
54

6-
## Todos:
5+
A lightweight micro-blog built with the Phoenix Framework, inspired by Joplin's note-taking organization. Create, categorize and share markdown notes in a clean, organized interface.
76

8-
[] Improve and restructure readme
9-
[] Add Earmark dependency for note body
10-
[] Implement db backups, either as download or email
7+
**Live Demo**: [https://holzlog.duckdns.org/](https://holzlog.duckdns.org/)
118

12-
## Features
9+
## Table of Contents
1310

14-
- **Note Creation**: A "Create Note" button at the top opens a form to create new notes. Uses a simple text area for content, allowing Markdown.
15-
- **Note Editing**: Each note displayed has an "Edit" button that opens a form to modify the note.
16-
- **Categories (Notebooks)**: Notes can be assigned to multiple categories.
17-
- **Category Sidebar**: A sidebar displays a list of categories/notebooks. Clicking a category filters the notes to only show those in that category. Clicking "All Notes" shows all notes.
18-
- **Search**: A search bar allows users to find notes by title or content.
19-
- **Markdown Support**: Note content is interpreted as Markdown for formatted display.
20-
- **SQLite Database**: Uses SQLite for easy setup and deployment.
21-
- **Tailwind CSS**: Styled with Tailwind CSS for a clean and responsive design.
11+
- [For Users](#for-users)
12+
- [Features](#features)
13+
- [Using Holz Log](#using-holz-log)
14+
- [For Developers](#for-developers)
15+
- [Tech Stack](#tech-stack)
16+
- [Architecture](#architecture)
17+
- [Database Schema](#database-schema)
18+
- [Setup and Installation](#setup-and-installation)
19+
- [Development](#development)
20+
- [Roadmap](#roadmap)
2221

23-
## Layout
22+
## For Users
2423

25-
The website consists of the following main sections:
24+
### Features
2625

27-
### Header
26+
- **Simple Note Management**: Create, edit, view, and organize notes with ease
27+
- **Category Organization**: Assign notes to multiple categories for flexible organization
28+
- **Quick Search**: Find notes by title or content with the built-in search feature
29+
- **Clean Interface**: Minimalist design focused on content readability
2830

29-
- Contains the site title/logo (if any)
30-
- "Create Note" button
31-
- Search bar
31+
### Using Holz Log
3232

33-
### Sidebar (Left)
33+
1. **Creating Notes**: Click the "Create Note" button in the header to create a new note
34+
2. **Organizing Notes**: Assign categories when creating or editing notes
35+
3. **Finding Notes**: Browse by category using the sidebar, or use the search function
36+
4. **Editing Notes**: Each note has an "Edit" button for quick modifications
3437

35-
- A list of all categories/notebooks
36-
- Each category is a clickable link
37-
- An "All Notes" link to display all notes regardless of category
38+
## For Developers
3839

39-
### Main Content Area (Right)
40+
### Tech Stack
4041

41-
- Displays a list of notes
42-
- Each note shows:
43-
- Title (clickable link to view the full note)
44-
- Short excerpt of the content (e.g., the first 100-200 characters)
45-
- The categories/notebooks the note is assigned to
46-
- An "Edit" button to open the edit form for that note
42+
- **Backend**:
4743

48-
### Single Note View
44+
- [Elixir](https://elixir-lang.org/) (v1.14+)
45+
- [Phoenix Framework](https://www.phoenixframework.org/) (v1.7+)
46+
- [Ecto](https://hexdocs.pm/ecto/Ecto.html) - Database abstraction layer
47+
- [SQLite](https://www.sqlite.org/) - Database (via [ecto_sqlite3](https://hexdocs.pm/ecto_sqlite3))
4948

50-
- Displays the full content of a single note
51-
- Shows the title and categories
52-
- An "Edit" button to edit the note
53-
- A "Back" button to return to the main notes list (or the category listing)
49+
- **Frontend**:
50+
- [Phoenix LiveView](https://hexdocs.pm/phoenix_live_view/) - For interactive UI components
51+
- [Tailwind CSS](https://tailwindcss.com/) - For styling
5452

55-
## Tailwind CSS Styling
53+
### Architecture
5654

57-
The site uses Tailwind CSS utility classes extensively. Here's a general overview of the styling approach:
55+
The application follows Phoenix's standard MVC architecture with LiveView components:
5856

59-
- **Readability**: Focus on clear typography, good line height, and sufficient padding/margin
60-
- **Color Palette**: Primarily light backgrounds, with a muted accent color for links, headings, and highlighting. Dark mode is not implemented in this iteration
61-
- **Responsive Design**: Uses Tailwind's responsive prefixes (e.g., `md:`, `lg:`) to adjust the layout for different screen sizes. The sidebar typically collapses to a top navigation bar on smaller screens
57+
- **Contexts**: Business logic organized into domain-specific modules
58+
- **Schema**: Ecto schemas representing database tables with validations
59+
- **Controllers/LiveViews**: Handle incoming requests and manage state
60+
- **Templates**: Render HTML responses using HEEx templates
6261

63-
## Database Schema (SQLite)
62+
#### UI Layout
6463

65-
The SQLite database consists of two main tables:
64+
- **Header**: Site title, create button, search bar
65+
- **Sidebar**: Category navigation
66+
- **Main Content**: Note listing or individual note view
6667

67-
### notes
68+
### Database Schema
69+
70+
The application uses a SQLite database with the following structure:
71+
72+
#### notes
6873

6974
```sql
7075
CREATE TABLE notes (
@@ -76,7 +81,7 @@ CREATE TABLE notes (
7681
);
7782
```
7883

79-
### categories
84+
#### categories
8085

8186
```sql
8287
CREATE TABLE categories (
@@ -85,7 +90,7 @@ CREATE TABLE categories (
8590
);
8691
```
8792

88-
### note_categories (Join Table)
93+
#### note_categories (Join Table)
8994

9095
```sql
9196
CREATE TABLE note_categories (
@@ -95,48 +100,47 @@ CREATE TABLE note_categories (
95100
);
96101
```
97102

98-
## Technologies Used
103+
### Setup and Installation
99104

100-
- **Phoenix Framework**: The web framework
101-
- **Ecto**: Database abstraction layer
102-
- **SQLite**: Database
103-
- **Tailwind CSS**: CSS framework
104-
- **Earmark**: Markdown parser
105+
1. **Prerequisites**:
105106

106-
## Setup Instructions
107+
- Elixir and Erlang installed ([installation guide](https://elixir-lang.org/install.html))
108+
- Phoenix Framework installed: `mix archive.install hex phx_new`
107109

108-
1. Install Elixir and Erlang:
110+
2. **Clone and Setup**:
109111

110-
- Follow the instructions on the [Elixir website](https://elixir-lang.org/install.html)
112+
```bash
113+
# Clone the repository
114+
git clone https://github.com/yourusername/holz_log.git
115+
cd holz_log
111116

112-
2. Install Phoenix:
117+
# Get dependencies
118+
mix deps.get
113119

114-
```bash
115-
mix archive.install hex phx_new
120+
# Setup database
121+
mix ecto.setup
116122
```
117123

118-
3. Create a new Phoenix project:
124+
3. **Run the Application**:
119125

120126
```bash
121-
mix phx.new my_microblog --no-html --no-webpack --no-dashboard
122-
cd my_microblog
127+
# Start Phoenix server
128+
mix phx.server
123129
```
124130

125-
- `--no-html` prevents the generation of the default HTML layouts (we'll use Tailwind instead)
126-
- `--no-webpack` skips the default webpack configuration since we'll use the simpler esbuild
127-
- `--no-dashboard` omits the Erlang Observer dashboard
128-
129-
4. Install esbuild:
130-
Add esbuild as a dependency in `mix.exs` and run `mix deps.get`:
131-
132-
```elixir
133-
defp deps do
134-
[
135-
{:phoenix, "~> 1.7.0"},
136-
{:ecto_sqlite3, "~> 0.2"},
137-
{:ecto_sql, "~> 3.0"},
138-
{:esbuild, "~> 0.8", runtime: Mix.env() == :dev},
139-
{:earmark, "~> 1.4"}
140-
]
141-
end
142-
```
131+
4. Visit [`localhost:4000`](http://localhost:4000) in your browser
132+
133+
### Development
134+
135+
- **Code Format**: `mix format`
136+
- **Start Interactive Console**: `iex -S mix`
137+
138+
## Roadmap
139+
140+
- [x] Basic note creation and management
141+
- [x] Category organization
142+
- [ ] Add Earmark dependency for note body
143+
- [ ] Do not list category IDs in frontend
144+
- [ ] Implement database backups (download or email)
145+
- [ ] Change after create & update redirects to go back to main page
146+
- [ ] Increase note preview character limit

screenshots/holzlog.png

203 KB
Loading

0 commit comments

Comments
 (0)