|
1 | | -# Mail Service for GNUWeeb |
| 1 | +<h1 align="center"> |
| 2 | + GNU/Weeb Mail |
| 3 | +</h1> |
| 4 | + |
| 5 | +<h2 id="table-of-contents"> |
| 6 | + Table of Contents |
| 7 | +</h2> |
| 8 | + |
| 9 | +- [Requirements](#requirements) |
| 10 | +- [How to Run](#how-to-run) |
| 11 | +- [How to Build](#how-to-build) |
| 12 | +- [Code Standards](#code-standards) |
| 13 | +- [How to Develop or Contribute](#how-to-develop) |
| 14 | + |
| 15 | +<h2 id="requirements"> |
| 16 | + Requirements |
| 17 | +</h2> |
| 18 | + |
| 19 | +- **NodeJS** version 18+,strongly recommended to use version 20+ as this project developed using **NodeJS** version 20+ |
| 20 | + [Download](https://nodejs.org/en/download) |
| 21 | +- **TypeScript** version 5, no need to download in your OS as this project will install the TypeScript only inside this project. |
| 22 | +- Code Editor, of course, we recommend using your favorite IDE, for example, [VS Code](https://code.visualstudio.com/download). |
| 23 | +- Svelte 5 Runes knowledge. |
| 24 | + |
| 25 | +<h2 id="how-to-run"> |
| 26 | + How to Run |
| 27 | +</h2> |
2 | 28 |
|
3 | | -## Requirements |
4 | | -- PHP 7.4+ |
5 | | -- MySQL 5.5+ |
| 29 | +```sh |
| 30 | +# install all dependencies before running this project |
| 31 | +npm i |
| 32 | +npm run dev |
| 33 | +``` |
| 34 | + |
| 35 | +<h2 id="how-to-build"> |
| 36 | + How to Build |
| 37 | +</h2> |
6 | 38 |
|
7 | | -## Setup Instructions (Ubuntu) |
8 | 39 | ```sh |
9 | | -sudo apt-get install libphp7.4-embed php7.4 php7.4-bcmath php7.4-bz2 php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-dba php7.4-dev php7.4-enchant php7.4-gd php7.4-gmp php7.4-imap php7.4-interbase php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-snmp php7.4-soap php7.4-sybase php7.4-tidy php7.4-xml php7.4-xmlrpc php7.4-xsl php7.4-zip -y |
| 40 | +# install all dependencies before building this project |
| 41 | +npm i |
| 42 | +npm run build |
| 43 | +``` |
10 | 44 |
|
11 | | -sudo apt-get install mysql-server -y; |
| 45 | +After build, the `dist` folder will be created, copy them to your own server, for example, [nginx](https://nginx.org/en/download.html). |
12 | 46 |
|
13 | | -# Check your MySQL version number |
14 | | -mysql --version; |
| 47 | +<h2 id="code-standards"> |
| 48 | +Code Standards |
| 49 | +</h2> |
15 | 50 |
|
16 | | -# Don't start mysql when boot (for local development only) |
17 | | -sudo systemctl disable mysql; |
| 51 | +We use `LF` for each End of Line style and add empty newline for every End of File, you must setting all that in your IDE before contributing on this project. |
18 | 52 |
|
19 | | -# Start mysql |
20 | | -sudo systemctl start mysql; |
| 53 | +<h2 id="how-to-develop"> |
| 54 | +How to Develop or Contribute |
| 55 | +</h2> |
21 | 56 |
|
22 | | -git clone https://github.com/GNUWeeb/mail.gnuweeb.org; |
23 | | -cd mail.gnuweeb.org; |
24 | | -``` |
| 57 | +<h3>Framework</h3> |
| 58 | + |
| 59 | +If you are new to **SvelteKit** using the **Svelte 5 Runes**, we recommend to learn the framework first, you can learn it [here](https://learn.svelte.dev) or just [read the docs](https://svelte.dev/docs/kit/introduction). |
| 60 | + |
| 61 | +<h3>Base Components</h3> |
| 62 | + |
| 63 | +We used [**shadcn-svelte**](https://www.shadcn-svelte.com/) for the base components, we strongly recommended to use it for now, if you want to add components, just go [here](https://www.shadcn-svelte.com/docs/components/accordion). |
| 64 | +This is how you add **shadcn-svelte** component |
25 | 65 |
|
26 | | -#### Setup (for MySQL 8) |
27 | 66 | ```sh |
28 | | -# Edit <username> and <password> with anything you want. |
29 | | -sudo mysql -e "CREATE USER IF NOT EXISTS '<username>'@'%' IDENTIFIED BY '<password>';"; |
30 | | -sudo mysql -e "SET PASSWORD FOR '<username>'@'%' = '<password>';"; |
31 | | -sudo mysql -e "GRANT ALL ON *.* TO '<username>'@'%';"; |
32 | | -sudo mysql -e "FLUSH PRIVILEGES;"; |
33 | | -sudo mysql -e "CREATE DATABASE gnuweeb;"; |
34 | | - |
35 | | -# Make sure you have cd'ed to mail.gnuweeb.org; |
36 | | -sudo mysql gnuweeb < database.sql; |
| 67 | +npx shadcn-svelte@latest add <component-name> |
37 | 68 | ``` |
38 | 69 |
|
| 70 | +After installed **shadcn-svelte** component, it will generated in [$lib/components/ui](./src/lib/components/ui/), if you want to have a small edit. |
39 | 71 |
|
40 | | -#### Setup (for MySQL 5.x and MariaDB) |
41 | | -```sh |
42 | | -# Edit <username> and <password> with anything you want. |
| 72 | +<h3>Custom Components</h3> |
43 | 73 |
|
44 | | -sudo mysql -e "GRANT ALL PRIVILEGES ON *.* TO '<username>'@'%' IDENTIFIED BY '<password>';"; |
45 | | -sudo mysql -e "FLUSH PRIVILEGES;"; |
46 | | -sudo mysql -e "CREATE DATABASE gnuweeb;"; |
| 74 | +If you want to create your own custom components you can create it in [$lib/components/customs](./src/lib/components/customs/). |
47 | 75 |
|
48 | | -# Make sure you have cd'ed to mail.gnuweeb.org; |
49 | | -sudo mysql gnuweeb < database.sql; |
50 | | -``` |
| 76 | +<h3>Static Files</h3> |
51 | 77 |
|
52 | | -### After the database is ready |
53 | | -```sh |
54 | | -# Make sure you have cd'ed to mail.gnuweeb.org; |
55 | | -cp -v config.example.php config.php; |
| 78 | +All static files were stored in [./static/](./static/). |
56 | 79 |
|
57 | | -# Generate APP_KEY for config.php |
58 | | -head -c 30 /dev/urandom | xxd -ps |
| 80 | +<h3>Page Routes</h3> |
59 | 81 |
|
60 | | -# Fix the config file, adjust with your database username/password. |
61 | | -vim config.php; |
| 82 | +All pages are created in [./src/routes](./src/routes/) and all protected routes (login required) are created in [./src/routes/(protected)](<./src/routes/(protected)/>). |
62 | 83 |
|
63 | | -# Start the PHP server. |
64 | | -php -S 0.0.0.0:8080 -t public/ |
65 | | -# And ready to develop! |
66 | | -# Access from your browser http://127.0.0.1:8080 |
67 | | -``` |
| 84 | +<h3>Hooks Functions</h3> |
| 85 | + |
| 86 | +All hooks are created in [$lib/hooks](./src/lib/hooks/). |
| 87 | + |
| 88 | +<h3>Form Schemas</h3> |
| 89 | + |
| 90 | +All form schemas are created in [$lib/schemas](./src/lib/schemas/). |
| 91 | + |
| 92 | +<h3>Constants</h3> |
| 93 | + |
| 94 | +All constants data are created in [$constants](./src/lib/constants/). |
| 95 | + |
| 96 | +<h3>Typings</h3> |
| 97 | + |
| 98 | +All types are created in [$typings](./src/lib/typings/). |
| 99 | + |
| 100 | +<h3>Utilities</h3> |
| 101 | + |
| 102 | +All util or helper functions are created in [$utils](./src/lib/utilities/). |
68 | 103 |
|
| 104 | +<h3>Styling</h3> |
69 | 105 |
|
70 | | -# Maintainer |
71 | | -- Ammar Faizi (@ammarfaizi2) |
| 106 | +If you want to create styles or CSS that only affects inside its page or component just write it inside that file, |
| 107 | +if you want to create styles or CSS that affects globally you can write it in [./src/app.css](./src/app.css). |
72 | 108 |
|
| 109 | +<h3>Aliases</h3> |
73 | 110 |
|
74 | | -# License |
75 | | -This project is licensed under the GNU GPL 2.0 license. |
| 111 | +You may add some import aliases, you can edit it in [svelte.config.js](./svelte.config.js), we used `$` as import alias, you must follow our standards to remain consistency. |
0 commit comments