Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Public files

Smaug67394bd661097013
diff --git a/.gitattributes b/.gitattributes
index 804305ba..72b5c572 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
-frontend/styles/katex/*.js linguist-vendored
+frontend/styles/katex/contrib/*.js linguist-vendored
frontend/styles/katex/*.css linguist-vendored
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..afaa98fe
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,128 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, religion, or sexual identity
+and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+- Demonstrating empathy and kindness toward other people
+- Being respectful of differing opinions, viewpoints, and experiences
+- Giving and gracefully accepting constructive feedback
+- Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+- Focusing on what is best not just for us as individuals, but for the
+ overall community
+
+Examples of unacceptable behavior include:
+
+- The use of sexualized language or imagery, and sexual attention or
+ advances of any kind
+- Trolling, insulting or derogatory comments, and personal or political attacks
+- Public or private harassment
+- Publishing others' private information, such as a physical or email
+ address, without their explicit permission
+- Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series
+of actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or
+permanent ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within
+the community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.0, available at
+https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct
+enforcement ladder](https://github.com/mozilla/diversity).
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at
+https://www.contributor-covenant.org/translations.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..ce41190d
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,26 @@
+# Contributing
+
+## How to set up the project
+
+### Prerequisites
+
+- [Bun](https://bun.sh/)
+- [Golang](https://go.dev/)
+- [MySQL](https://www.mysql.com/)
+
+### Clone the database
+
+The SQL model is in the `database` folder. You can import it to your MySQL database.
+
+It's not necessary to fill the `City_IPv4_complete`, `City_IPv6_complete`, `City_Locations_fr` tables. They are used for the geolocation feature.
+
+### Steps
+
+1. Clone the repository.
+2. Go to /backend and run `bun install`, change `.env.example` to `.env` and then start with `bun main.ts`.
+3. Go to /cdn and start with `go run main.go`.
+4. Go to /frontend and run `bun install`, and then start with `bun dev`.
+
+### How to contribute
+
+Don't hesitate to contribute to the project. You can open an issue or a pull request :)
diff --git a/README.md b/README.md
index b83fb637..8a4839ab 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,22 @@
-# Alexandrie V6
+# Alexandrie
+
+<img src="./frontend/public/Logo/Alexandrie-logo-dark.png" width="120" align="left">
+
+A website for taking beautiful notes in extended Markdown format.
+Currently, the project is in development and it's not possible to create an account with the [hosted version](https://alexandrie-hub.fr).
+If you want to test or use it, don't hesitate to open an issue and I will activate the account creation feature.
+
+## Features πŸš€
![image](https://github.com/user-attachments/assets/5df4a612-de76-49b3-9c0a-aef7514eb2db)
![image](https://github.com/user-attachments/assets/a4fb0079-5ba3-4f28-be2a-04c5ea39cb38)
![image](https://github.com/user-attachments/assets/d4dde490-b300-4774-822a-aa0284a8ffb0)
![image](https://github.com/user-attachments/assets/8b57f163-0c94-499d-96af-d0f4645b5b75)
![image](https://github.com/user-attachments/assets/299d5a73-faf9-4623-906d-55dbcf2dea6f)
+
+## Contributing 🌍
+
+This project has an MIT license. And you are welcome to contribute.
+For more details on contributions, please read the [CONTRIBUTING.md](./CONTRIBUTING.md) file.
+
+> Thank you to everyone who contributes to the project. πŸŽ‰
diff --git a/backend/.env.example b/backend/.env.example
new file mode 100644
index 00000000..60fe6ba6
--- /dev/null
+++ b/backend/.env.example
@@ -0,0 +1,8 @@
+PORT=3001
+DATABASE_USER=
+DATABASE_PASSWORD=
+NODE_ENV=development
+JWT_SECRET=
+
+DOMAIN_CLIENT=http://domain:port
+FRONT_DOMAIN=domain
\ No newline at end of file
diff --git a/database/alexandrie.sql b/database/alexandrie.sql
new file mode 100644
index 00000000..75fe40ec
--- /dev/null
+++ b/database/alexandrie.sql
@@ -0,0 +1,240 @@
+-- MySQL dump 10.13 Distrib 8.0.37, for Linux (x86_64)
+--
+-- Host: 127.0.0.1 Database: alexandrie
+-- ------------------------------------------------------
+-- Server version 8.0.37-0ubuntu0.24.04.1
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!50503 SET NAMES utf8mb4 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `City_IPv4_complete`
+--
+
+DROP TABLE IF EXISTS `City_IPv4_complete`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `City_IPv4_complete` (
+ `network_start_integer` bigint DEFAULT NULL,
+ `network_last_integer` bigint DEFAULT NULL,
+ `geoname_id` int DEFAULT NULL,
+ `registered_country_geoname_id` int DEFAULT NULL,
+ `represented_country_geoname_id` text,
+ `is_anonymous_proxy` int DEFAULT NULL,
+ `is_satellite_provider` int DEFAULT NULL,
+ `postal_code` text,
+ `latitude` double DEFAULT NULL,
+ `longitude` double DEFAULT NULL,
+ `accuracy_radius` int DEFAULT NULL,
+ `is_anycast` text,
+ KEY `City_IPv4_complete_City_Locations_fr_geoname_id_fk` (`geoname_id`),
+ CONSTRAINT `City_IPv4_complete_City_Locations_fr_geoname_id_fk` FOREIGN KEY (`geoname_id`) REFERENCES `City_Locations_fr` (`geoname_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `City_IPv6_complete`
+--
+
+DROP TABLE IF EXISTS `City_IPv6_complete`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `City_IPv6_complete` (
+ `network_start_integer` double DEFAULT NULL,
+ `network_last_integer` double DEFAULT NULL,
+ `geoname_id` int DEFAULT NULL,
+ `registered_country_geoname_id` int DEFAULT NULL,
+ `represented_country_geoname_id` text,
+ `is_anonymous_proxy` int DEFAULT NULL,
+ `is_satellite_provider` int DEFAULT NULL,
+ `postal_code` text,
+ `latitude` double DEFAULT NULL,
+ `longitude` text,
+ `accuracy_radius` text,
+ `is_anycast` text,
+ KEY `City_IPv6_complete_City_Locations_fr_geoname_id_fk` (`geoname_id`),
+ CONSTRAINT `City_IPv6_complete_City_Locations_fr_geoname_id_fk` FOREIGN KEY (`geoname_id`) REFERENCES `City_Locations_fr` (`geoname_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `City_Locations_fr`
+--
+
+DROP TABLE IF EXISTS `City_Locations_fr`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `City_Locations_fr` (
+ `geoname_id` int NOT NULL,
+ `locale_code` text,
+ `continent_code` text,
+ `continent_name` text,
+ `country_iso_code` text,
+ `country_name` text,
+ `subdivision_1_iso_code` text,
+ `subdivision_1_name` text,
+ `subdivision_2_iso_code` text,
+ `subdivision_2_name` text,
+ `city_name` text,
+ `metro_code` text,
+ `time_zone` text,
+ `is_in_european_union` text,
+ PRIMARY KEY (`geoname_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `categories`
+--
+
+DROP TABLE IF EXISTS `categories`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `categories` (
+ `id` varchar(50) NOT NULL,
+ `name` varchar(50) NOT NULL,
+ `icon` text,
+ `order` int DEFAULT NULL,
+ `parent_id` varchar(50) DEFAULT NULL,
+ `author_id` varchar(50) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `categories_categories_id_fk` (`parent_id`),
+ KEY `categories_users_id_fk` (`author_id`),
+ CONSTRAINT `categories_categories_id_fk` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`),
+ CONSTRAINT `categories_users_id_fk` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `connections_logs`
+--
+
+DROP TABLE IF EXISTS `connections_logs`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `connections_logs` (
+ `id` varchar(50) NOT NULL,
+ `user_id` varchar(50) NOT NULL,
+ `ip_adress` varchar(50) DEFAULT NULL,
+ `user_agent` varchar(200) DEFAULT NULL,
+ `location` varchar(100) DEFAULT NULL,
+ `type` varchar(10) NOT NULL,
+ `timestamp` bigint NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `connections_logs_users_id_fk` (`user_id`),
+ CONSTRAINT `connections_logs_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `documents`
+--
+
+DROP TABLE IF EXISTS `documents`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `documents` (
+ `id` varchar(50) NOT NULL,
+ `name` varchar(50) NOT NULL,
+ `description` varchar(255) DEFAULT NULL,
+ `tags` varchar(200) DEFAULT NULL,
+ `category` varchar(50) DEFAULT NULL,
+ `parent_id` varchar(50) DEFAULT NULL,
+ `accessibility` tinyint(1) NOT NULL,
+ `content_markdown` longtext,
+ `content_html` longtext,
+ `author_id` varchar(50) NOT NULL,
+ `created_timestamp` bigint NOT NULL,
+ `updated_timestamp` bigint NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `author_id` (`author_id`),
+ KEY `category` (`category`),
+ KEY `documents_ibfk_3` (`parent_id`),
+ CONSTRAINT `documents_ibfk_2` FOREIGN KEY (`category`) REFERENCES `categories` (`id`),
+ CONSTRAINT `documents_ibfk_3` FOREIGN KEY (`parent_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `documents_users_id_fk` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `ressources`
+--
+
+DROP TABLE IF EXISTS `ressources`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `ressources` (
+ `id` varchar(50) NOT NULL,
+ `filename` varchar(50) NOT NULL,
+ `file_size` int NOT NULL,
+ `file_type` varchar(100) NOT NULL,
+ `original_path` varchar(100) NOT NULL,
+ `transformed_path` varchar(100) DEFAULT NULL,
+ `author_id` varchar(50) NOT NULL,
+ `created_timestamp` bigint NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `ressources_users_id_fk` (`author_id`),
+ CONSTRAINT `ressources_users_id_fk` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='For CDN';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `sessions`
+--
+
+DROP TABLE IF EXISTS `sessions`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `sessions` (
+ `id` varchar(50) NOT NULL,
+ `user_id` varchar(50) NOT NULL,
+ `refresh_token` varchar(255) DEFAULT NULL,
+ `expire_token` bigint DEFAULT NULL,
+ `last_refresh_timestamp` bigint DEFAULT NULL,
+ `active` int DEFAULT NULL,
+ `login_timestamp` bigint DEFAULT NULL,
+ `logout_timestamp` bigint DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `users_auth_users_id_fk` (`user_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `users`
+--
+
+DROP TABLE IF EXISTS `users`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `users` (
+ `id` varchar(50) NOT NULL,
+ `username` varchar(25) NOT NULL,
+ `firstname` varchar(25) DEFAULT NULL,
+ `lastname` varchar(25) DEFAULT NULL,
+ `avatar` varchar(75) DEFAULT NULL,
+ `email` varchar(50) NOT NULL,
+ `password` varchar(255) NOT NULL,
+ `created_timestamp` bigint NOT NULL,
+ `updated_timestamp` bigint NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2024-07-29 13:28:38
diff --git a/frontend/public/Logo/_Alexandrie-logo-blue.png b/frontend/public/Logo/_Alexandrie-logo-blue.png
new file mode 100644
index 00000000..e69de29b