1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-12-08 00:44:30 +01:00

feat(posts): add thream-v1-0-0

This commit is contained in:
Divlo 2022-04-11 12:31:19 +02:00
parent bce254a355
commit 2c3a70df2a
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
15 changed files with 3774 additions and 2862 deletions

View File

@ -1,8 +0,0 @@
.next
.lighthouseci
storybook-static
coverage
node_modules
next-env.d.ts
**/workbox-*.js
**/sw.js

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ out
build build
dist dist
public/*.html public/*.html
jsonresume-theme-custom/theme/index.html
# PWA # PWA
public/workbox-*.js public/workbox-*.js
public/sw.js public/sw.js

View File

@ -6,6 +6,5 @@
"jest --findRelatedTests" "jest --findRelatedTests"
], ],
"*.{css,scss,sass,json,jsonc,yml,yaml}": ["prettier --write"], "*.{css,scss,sass,json,jsonc,yml,yaml}": ["prettier --write"],
"*.{md,mdx}": ["prettier --write", "markdownlint --dot --fix"], "*.{md,mdx}": ["prettier --write", "markdownlint --dot --fix"]
"resume.json": ["resume validate"]
} }

View File

@ -1,9 +0,0 @@
.next
.lighthouseci
storybook-static
coverage
node_modules
next-env.d.ts
**/workbox-*.js
**/sw.js
*.hbs

View File

@ -1,15 +1,15 @@
FROM node:16.14.0 AS dependencies FROM node:16.14.2 AS dependencies
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY ./package*.json ./ COPY ./package*.json ./
RUN npm install RUN npm install
FROM node:16.14.0 AS builder FROM node:16.14.2 AS builder
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY ./ ./ COPY ./ ./
COPY --from=dependencies /usr/src/app/node_modules ./node_modules COPY --from=dependencies /usr/src/app/node_modules ./node_modules
RUN npm run build RUN npm run build
FROM node:16.14.0 AS runner FROM node:16.14.2 AS runner
WORKDIR /usr/src/app WORKDIR /usr/src/app
ENV NODE_ENV=production ENV NODE_ENV=production
COPY --from=builder /usr/src/app/next.config.js ./next.config.js COPY --from=builder /usr/src/app/next.config.js ./next.config.js

File diff suppressed because it is too large Load Diff

View File

@ -10,10 +10,10 @@
"modern-normalize": "1.1.0" "modern-normalize": "1.1.0"
}, },
"devDependencies": { "devDependencies": {
"@parcel/config-default": "2.4.0", "@parcel/config-default": "2.4.1",
"@parcel/core": "2.4.0", "@parcel/core": "2.4.1",
"@parcel/optimizer-data-url": "2.4.0", "@parcel/optimizer-data-url": "2.4.1",
"@parcel/transformer-inline-string": "2.4.0", "@parcel/transformer-inline-string": "2.4.1",
"parcel": "2.4.0" "parcel": "2.4.1"
} }
} }

4630
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,8 +18,8 @@
"lint:commit": "commitlint", "lint:commit": "commitlint",
"lint:editorconfig": "editorconfig-checker", "lint:editorconfig": "editorconfig-checker",
"lint:markdown": "markdownlint \"**/*.{md,mdx}\" --dot --ignore-path \".gitignore\"", "lint:markdown": "markdownlint \"**/*.{md,mdx}\" --dot --ignore-path \".gitignore\"",
"lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\"", "lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
"lint:prettier": "prettier \".\" --check", "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
"lint:staged": "lint-staged", "lint:staged": "lint-staged",
"test:unit": "jest", "test:unit": "jest",
"test:html-w3c-validator": "start-server-and-test \"start\" \"http://localhost:3000\" \"html-w3c-validator\"", "test:html-w3c-validator": "start-server-and-test \"start\" \"http://localhost:3000\" \"html-w3c-validator\"",
@ -40,12 +40,12 @@
"classnames": "2.3.1", "classnames": "2.3.1",
"date-and-time": "2.3.0", "date-and-time": "2.3.0",
"gray-matter": "4.0.3", "gray-matter": "4.0.3",
"html-react-parser": "1.4.9", "html-react-parser": "1.4.10",
"next": "12.1.0", "next": "12.1.4",
"next-mdx-remote": "4.0.0", "next-mdx-remote": "4.0.2",
"next-pwa": "5.4.6", "next-pwa": "5.4.7",
"next-themes": "0.1.1", "next-themes": "0.1.1",
"next-translate": "1.3.5", "next-translate": "1.4.0",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2", "react-dom": "17.0.2",
"read-pkg": "7.1.0", "read-pkg": "7.1.0",
@ -65,25 +65,25 @@
"@saithodev/semantic-release-backmerge": "2.1.2", "@saithodev/semantic-release-backmerge": "2.1.2",
"@semantic-release/git": "10.0.1", "@semantic-release/git": "10.0.1",
"@tailwindcss/typography": "0.5.2", "@tailwindcss/typography": "0.5.2",
"@testing-library/jest-dom": "5.16.2", "@testing-library/jest-dom": "5.16.4",
"@testing-library/react": "12.1.4", "@testing-library/react": "12.1.4",
"@types/jest": "27.4.1", "@types/jest": "27.4.1",
"@types/node": "17.0.23", "@types/node": "17.0.23",
"@types/react": "17.0.42", "@types/react": "17.0.43",
"@types/unist": "2.0.6", "@types/unist": "2.0.6",
"@typescript-eslint/eslint-plugin": "5.16.0", "@typescript-eslint/eslint-plugin": "5.18.0",
"autoprefixer": "10.4.4", "autoprefixer": "10.4.4",
"cypress": "9.5.2", "cypress": "9.5.3",
"editorconfig-checker": "4.0.2", "editorconfig-checker": "4.0.2",
"eslint": "8.11.0", "eslint": "8.13.0",
"eslint-config-conventions": "1.1.2", "eslint-config-conventions": "2.0.0",
"eslint-config-next": "12.1.0", "eslint-config-next": "12.1.4",
"eslint-config-prettier": "8.5.0", "eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.25.4", "eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "4.0.0", "eslint-plugin-prettier": "4.0.0",
"eslint-plugin-promise": "6.0.0", "eslint-plugin-promise": "6.0.0",
"eslint-plugin-unicorn": "41.0.1", "eslint-plugin-unicorn": "42.0.0",
"html-w3c-validator": "1.1.0", "html-w3c-validator": "1.2.0",
"husky": "7.0.4", "husky": "7.0.4",
"jest": "27.5.1", "jest": "27.5.1",
"jsonresume-theme-custom": "file:./jsonresume-theme-custom", "jsonresume-theme-custom": "file:./jsonresume-theme-custom",
@ -91,12 +91,12 @@
"markdownlint-cli": "0.31.1", "markdownlint-cli": "0.31.1",
"next-secure-headers": "2.2.0", "next-secure-headers": "2.2.0",
"postcss": "8.4.12", "postcss": "8.4.12",
"prettier": "2.6.0", "prettier": "2.6.2",
"prettier-plugin-tailwindcss": "0.1.8", "prettier-plugin-tailwindcss": "0.1.8",
"semantic-release": "19.0.2", "semantic-release": "19.0.2",
"start-server-and-test": "1.14.0", "start-server-and-test": "1.14.0",
"tailwindcss": "3.0.23", "tailwindcss": "3.0.23",
"typescript": "4.6.2", "typescript": "4.6.3",
"vercel": "24.0.1" "vercel": "24.0.1"
} }
} }

124
posts/thream-v1-0-0.mdx Normal file
View File

@ -0,0 +1,124 @@
---
title: '🟢 Thream v1.0.0'
description: 'Your open source platform to stay close with your friends and communities, talk, chat, collaborate, share and have fun.'
isPublished: true
publishedOn: '2022-04-11T10:24:55.206Z'
---
Hello! 👋
After months of hard work, [Thream v1.0.0](https://www.thream.divlo.fr/) has been released! 🎉
[**Thream**](https://www.thream.divlo.fr/) is your open-source platform to stay close with your friends and communities, talk, chat, collaborate, share and have fun.
## Presentation
[**Thream**](https://www.thream.divlo.fr/) is a social network to stay close with your friends and communities to talk, chat, collaborate and share.
The project is largely inspired by [Discord](https://discord.com), a proprietary instant messaging service, but differentiates itself by its **non-profit open source philosophy** and will integrate special features.
The source code is available on [GitHub](https://github.com/Thream).
The idea is that a user can create an account to authenticate with an email address, and a password, or directly use an account from another platform (currently supported: Google, GitHub, Discord). Once the user is authenticated, he/she can create and join "guilds", in other words communities, in order to discuss with other people in several channels to group discussions talking about the same subject.
![The Thream app on a community page](/images/posts/thream-v1-0-0/thream-ui.png)
[**Thream**](https://www.thream.divlo.fr/) is a website that works on any recent browser, accessible on [thream.divlo.fr](https://www.thream.divlo.fr/).
## History
The idea for the project has existed since May 13, 2020, symbolized by a [publication on Twitter](https://twitter.com/Divlo_FR/status/1260638175246135296) by the creator: Divlo.
The main goal is to put into **practice knowledge in web development** and computer science in general on a concrete project that can **easily evolve over time** where you can add many features.
The development of the project begins under the name of **SocialProject**, on August 20, 2020, with colors close to the image of Divlo.
![SocialProject](/images/posts/thream-v1-0-0/social-project.jpg)
When I started the project, I had little knowledge of database design, real-time management or the architecture of such a large <abbr title="Information Technology">IT</abbr> project, so this will be accompanied by many technical problems, to which we will need to find appropriate solutions.
On October 19, 2020, **SocialProject** becomes **Thream**, an invented name, not yet used and more original than the previous one, and also changes colors so that the application is accessible in two distinct themes (light and dark).
With the help of [Walidoux](https://github.com/Walidoux), a junior developer really good at making beautiful <abbr title="User Interface">UI</abbr> with <abbr title="Cascading Style Sheets">CSS</abbr>, we were able to collaborate on this side project together.
Since the project is mainly developed during free time (mainly on weekends), the project took longer to be developed than desired, but now we finally released the first version. 🥳
## Implementation and Technical Difficulties
### Architecture
**Thream** is divided into two distinct projects:
- The **server** part, called **backend**, which the user does not see, allows actions to be taken to save or recover data in the **database**, it is the technical and functional aspect of the project. This part uses a style of software architecture defining a set of constraints to be used to create web services that establish interoperability between computers on the Internet, called REST <abbr title="Application Programming Interface">API</abbr>.
- The **client** part, called **frontend**, what **the user sees on the screen**, such as forms, buttons and all the **graphic elements** with which the user can interact from a browser.
<p className='flex flex-col items-center justify-center'>
<img
alt='HTTP Communication Schema'
src='/images/posts/thream-v1-0-0/http-communication.png'
/>
</p>
This design allows the separation between the client and the server, as long as they both structure their communication according to the <abbr title="Representational state transfer">REST</abbr> architectural guidelines, using the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> protocol, they will be able to communicate with each other, which makes it possible to work independently on the backend and on the frontend using different technologies and skills, really useful in teamwork.
To allow the development of this design, it is necessary to think about its architecture in order to solve the following problem: how to store and structure the folders and files of a source code in order to find which file to modify to correct a problem with a particular feature, or to add a feature?
There are two main architectures to solve this problem:
- The **Monorepo** architecture is a single directory containing several distinct projects with well-defined relationships, i.e. it allows the modification of the code in the client and server part simultaneously in the same place by verifying that a modification in the server part does not impact the client part.
- The **Polyrepo** architecture are several directories, a directory corresponding to a project.
Both architectures track source code file history using version control systems such as [git](https://git-scm.com/).
**Thream**, uses the **Polyrepo** architecture, to make it easier to set up and allows complete independence between client and server code.
### Technologies
Now that we have discussed, on the architecture of the source code, we will discuss the choice of technologies. The chosen technologies must meet the need, and allow the developer to be productive to quickly have a result. Often there are several possible technologies to meet the same need, so it is a question of choosing the technology that you prefer and that you know best.
To ease the development, we chose for **Thream** to use the [TypeScript](https://www.typescriptlang.org/), an open source programming language made by Microsoft. It's a stricter syntactic superset of **JavaScript**, and adds optional static typing to the language, meaning we can assign a "type" (`string`, `number`, `boolean` etc.) to each data/variable in the code, which has the advantage of identifying program errors even before execution and thus greatly improves developer productivity.
The **TypeScript** code is then compiled into **JavaScript** language which is one of the basic technologies of the **World Wide Web**, alongside HTML and CSS (in the client part), this makes it possible to make the pages of websites **interactive** by executing code depending on a certain event, for example when clicking on a button, or when pressing a key on the keyboard.
Since the creation of **Node.js** in 2009, it is now also possible to execute **JavaScript** outside the browser, for example on a server. **Node.js is a runtime environment** that offers modules that handle various basic features for interacting with files/folders, networking (DNS, HTTP, TCP, TLS/SSL, or UDP), and other functions inaccessible from a browser and designed to reduce the complexity of developing server applications.
**TypeScript** allows you to code with the same programming language, the client part and the server part, with different needs.
### User Interface (frontend)
The needs of the graphical interface (the client part):
- be accessible through a web browser
- allow the user to install the application
- adapts to screen size
- real-time data update (example: when a new message is sent)
- save the authenticated user (in cookie)
In order to meet its needs, Thream is a **<abbr title="Progressive Web App">PWA</abbr>**, this consists of making a website appear to the user as a native application, which makes it possible to combine the functionalities of browsers with those of the experience offered by native applications, such as the possibility of installing the application. The main advantage is to be able to **code once** and to provide the **application on several platforms (iOS, Android, Windows, GNU/Linux etc.)** without the need to develop specifically according to each platform.
To design a **<abbr title="Progressive Web App">PWA</abbr>**, and allow updating the data on the graphical interface, we can use a framework, a development infrastructure to offer us a set of tools and software components. For **Thream**, we use [Next.js](https://nextjs.org/), a framework based on [React.js](https://reactjs.org/), which allows you to create interactive user interfaces in JavaScript, to **update the graphical interface when the data changes**.
### Server (backend)
By using the protocol, **<abbr title="Hypertext Transfer Protocol">HTTP</abbr>**, it is the client who sends a request to the server, but to allow the transfer of data in real time, the **<abbr title="Hypertext Transfer Protocol">HTTP</abbr>** protocol is no longer sufficient.
We use **WebSockets** so that it is the server that send a response to all connected clients without the client requesting to the server to get a response, the server sends responses according to events, for example when creating or deleting a message.
Thanks to [Fastify](https://www.fastify.io/), a fast and low overhead web framework, for Node.js and [Socket.io](https://socket.io/), a bidirectional and low-latency communication for every platform, we can easily make REST API and real time communication.
To store the data, we use [PostgreSQL](https://www.postgresql.org/) database, and [Prisma](https://www.prisma.io/), a <abbr title="Object-Relational Mapping">ORM</abbr> for Node.js, which allows us to easily interact with the database without the need of writing <abbr title="Structured Query Language">SQL</abbr> ourselves.
## Current and future state
The main interest of **Thream** is to be able to put into practice the computer knowledge acquired as an autodidact on a concrete project, in order to learn, and understand the problems and potential solutions to complex computer applications such as social networks.
Now that the first version of **Thream** has been released, there may not be any major evolution thereafter, the project will continue to be maintained to fix any bugs, and remain accessible, for as long as possible.
The other interest of the project is that it is completely **open-source**, and allows those who want to contribute to the development, and add new features.
**Thream** is **non-profit** and therefore has no financial goal, deadline or specific feature target, which makes the design of the project a hobby and a way to learn new concepts.
Feel free to give feebacks and suggestions to improve the project, and to report any bug you find.
**Thream** is available: [**thream.divlo.fr**](https://www.thream.divlo.fr/).

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -6,7 +6,7 @@
"basics": { "basics": {
"name": "Théo LUDWIG", "name": "Théo LUDWIG",
"label": "Développeur Full Stack Junior • Passionné de High-Tech", "label": "Développeur Full Stack Junior • Passionné de High-Tech",
"image": "https://s.gravatar.com/avatar/ebd6e0bf679562c20e28b5ffd02bf3e5?s=100&amp;r=pg&amp;d=mm", "image": "https://divlo.fr/images/logo_orange.png",
"email": "contact@divlo.fr", "email": "contact@divlo.fr",
"location": {}, "location": {},
"url": "https://divlo.fr", "url": "https://divlo.fr",