Skip to content

Commit

Permalink
update database setup and create trpc based api
Browse files Browse the repository at this point in the history
  • Loading branch information
younes200 committed Sep 21, 2023
1 parent c749a32 commit 38fa57d
Show file tree
Hide file tree
Showing 24 changed files with 1,691 additions and 340 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
191 changes: 118 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,147 +1,192 @@
# Celluloid

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Docker Build](https://github.com/celluloid-camp/celluloid/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/celluloid-camp/celluloid/actions/workflows/build.yml)
[![Gitter chat](https://badges.gitter.im/celluloid-camp.png)](https://gitter.im/celluloid-camp)

## What is this?
## Overview

Celluloid is a collaborative video annotation application designed for educational purposes.
Celluloid is a collaborative video annotation application designed for
educational purposes.

Find a [PeerTube](https://joinpeertube.org/) video, choose an educational objective, annotate the video, share it with your students,
collect their answers, answer their questions.
With Celluloid, you can find a [PeerTube](https://joinpeertube.org/) video,
select an educational objective, annotate the video, share it with your
students, collect their answers, and respond to their questions.

## ✨ Demo

Head to https://celluloid.huma-num.fr/, create an account and click where you think you should!

We'd appreciate your feedback about the application UX and design, as well as bug reports - don't hesitate to [report an issue!](https://github.com/celluloid-camp/celluloid/issues)
Visit https://celluloid.huma-num.fr/, create an account, and start using
Celluloid.

We value your feedback on the application's user experience and design. If you
encounter any bugs or issues, please don't hesitate to
[report them](https://github.com/celluloid-camp/celluloid/issues).

## Who's behind it?
## Development Team

Celluloid was born from a research project lead by **Michaël Bourgatte** and **Laurent Tessier**,
two senior lecturers at the [Catholic University of Paris](https://en.icp.fr/english-version/).
Their work focus on educational science and digital humanities.
Celluloid originated from a research project led by **Michaël Bourgatte** and
**Laurent Tessier**, two senior lecturers at the
[Catholic University of Paris](https://en.icp.fr/english-version/). Their work
focuses on educational science and digital humanities.

Celluloid is maintained by [Younes Benaomar](https://github.com/younes200), and **we are actively looking for contributors and maintainers**.
Don't hesitate to [drop us a line on gitter!](https://gitter.im/celluloid-camp)
Celluloid is currently maintained by
[Younes Benaomar](https://github.com/younes200), and we actively encourage
contributions and involvement from the community. Feel free to reach out to us
on [Gitter](https://gitter.im/celluloid-camp).

# Setup

## Prerequisites

### Environment

Celluloid was designed to run on a Linux server.

To deploy and install Celluloid, knowing your way around the command-line is required. **Using an OSX or Linux workstation is highly recommended**.
Celluloid is designed to run on a Linux server. Proficiency with the
command-line interface is necessary for deployment and installation. It's highly
recommended to use an OSX or Linux workstation.

### Tools
### 🔨 Tools

- install the latest and greatest version of [git](https://git-scm.com/) (obviously)
- install the latest version of [nodejs](https://nodejs.org/en/)
- install the latest version of [Yarn](https://yarnpkg.com/en/) and use it instead of NPM. The project is organized as a [monorepo](https://blog.scottlogic.com/2018/02/23/javascript-monorepos.html) so it needs yarn to leverage [Yarn workspace](https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/)
- Install the latest version of [Git](https://git-scm.com/).
- Install the latest version of [Node.js](https://nodejs.org/en/).
- Install the latest version of [Yarn](https://yarnpkg.com/en/) and use it
instead of NPM. The project is organized as a
[monorepo](https://blog.scottlogic.com/2018/02/23/javascript-monorepos.html),
so Yarn is required to leverage
[Yarn workspace](https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/).

### 📦 Database

You'll need a working [PostgreSQL server](https://www.postgresql.org/docs/current/static/tutorial-install.html), version 9.6 or later.
You will need a working
[PostgreSQL server](https://www.postgresql.org/docs/current/static/tutorial-install.html),
version 13 or later.

For development purpose, you can use the provided Docker Compose [docker compose file](docker-compose.yml) and run the command:
For development purposes, you can use the provided Docker Compose
[docker-compose.yml](docker-compose.yml) and run the command:

docker-compose up -d
```bash
docker-compose up -d
```

Then:
Afterward:

1. [create a user](https://www.postgresql.org/docs/current/static/app-createuser.html) for celluloid
2. [create a database](https://www.postgresql.org/docs/current/static/manage-ag-createdb.html) owned by this user. You can follow [this tutorial](https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e) to get setup quickly.
1. [Create a user](https://www.postgresql.org/docs/current/static/app-createuser.html)
for Celluloid.
2. [Create a database](https://www.postgresql.org/docs/current/static/manage-ag-createdb.html)
owned by this user. You can follow
[this tutorial](https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e)
for quick setup.

### Emails

A working SMTP server is required to send account confirmation emails.
A functioning SMTP server is necessary for sending account confirmation emails.

For development purpose, you could use your email account SMTP credentials, for instance [gmail](https://support.google.com/a/answer/176600?hl=en), or a dedicated service, such as [mailtrap](https://mailtrap.io/register/signup)
For development purposes, you could use your email account SMTP credentials
(e.g., [Gmail](https://support.google.com/a/answer/176600?hl=en)) or a dedicated
service like [Mailtrap](https://mailtrap.io/register/signup).

## Installation from source
## Installation from Source

### First steps
### Initial Steps

Fire up a terminal and run the following commands:
Open your terminal and execute the following commands:

git clone https://github.com/celluloid-edu/celluloid
cd celluloid/
yarn
```bash
git clone https://github.com/celluloid-edu/celluloid
cd celluloid/
yarn
```

### Configuration

In a terminal, at the root of the repository, run
In the terminal, at the repository's root, run:

cp sample.env .env
```bash
cp sample.env .env
```

Open the newly created .env file with your favorite text editor and set the values that'll work for you.
Open the newly created .env file with your preferred text editor and configure
the values according to your requirements.

### Running the Application in Development Mode

### Docker container
First, ensure that the database is up and running. Then:

For a quick run use the docker command line :
```bash
yarn database setup
```

docker container run --rm --name celluloid \
-e CELLULOID_PG_HOST='localhost' \
-e CELLULOID_PG_PORT=5432 \
-e CELLULOID_PG_DATABASE='celluloid' \
-e CELLULOID_PG_USER='postgres' \
-e CELLULOID_PG_PASSWORD='root' \
-e CELLULOID_COOKIE_SECRET='XXX' \
--net=host \
ghcr.io/celluloid-camp/celluloid:v1
At the root of your repository, run:

```bash
yarn dev
```

### Running the app in development mode
This will initiate an interactive build and open the app in a browser window
while continuously monitoring source files for modifications.

At the root of your repository, run
If everything worked without errors, you should be all set. Otherwise, please
review the instructions above carefully.

yarn dev
### Building and Starting the Application in Production Mode

This will trigger an interactive build, open up the app in a browser window while continuously watching the source files for modifications.
At the repository's root, execute:

**that's it!** if everything worked without errors, you should be all set. If not, please carefully review the instructions above.
```bash
yarn build
yarn start
```

### Building and starting the app in production mode
You can access your app at http://localhost:3001.

At the root of your repository, run
### Building and Starting the Application as a Docker Container

yarn build
yarn start
Open a terminal at the repository's root and run:

You should be able to access your app at http://localhost:3001
```bash
docker-compose -f Dockerfile
```

### Building and starting the app as a docker container
(Ensure that [Docker](https://www.docker.com/get-started) is correctly
installed.)

Open a terminal at the root of your repository, then run
### Docker Container

docker compose -f Dockerfile
For a quick run using the Docker command line:

(make sure [Docker](https://www.docker.com/get-started) is properly installed beforehand!)
```bash
docker container run --rm --name celluloid \
-e CELLULOID_PG_HOST='localhost' \
-e CELLULOID_PG_PORT=5432 \
-e CELLULOID_PG_DATABASE='celluloid' \
-e CELLULOID_PG_USER='postgres' \
-e CELLULOID_PG_PASSWORD='root' \
-e CELLULOID_COOKIE_SECRET='XXX' \
--net=host \
ghcr.io/celluloid-camp/celluloid:v1
```

# Contributing

**We are actively looking for motivated contributors!**.
**We actively welcome motivated contributors!**

Do not hesitate to open a pull request, [contact us on gitter](https://gitter.im) or [report a bug!](https://github.com/celluloid-camp/celluloid/issues)
Feel free to open a pull request, [contact us on Gitter](https://gitter.im), or
[report a bug](https://github.com/celluloid-camp/celluloid/issues).

## Roadmap
- Administration GUI: content curation and moderation, user administration
- Real-time annotation and comment updating using Websockets or SSE

- Real-time annotation and comment updating using Websockets or SSE.

## Technical Stack

Before contributing to the development of Celluloid, you should get familiar with some of the following technologies:
Before contributing to Celluloid's development, it's essential to familiarize
yourself with some of the following technologies:

- everywhere: [TypeScript](https://www.typescriptlang.org/)
- frontend: [React](https://reactjs.org/), [Redux](https://redux.js.org/) and [Material UI](https://material-ui.com/)
- backend: [node.js](https://nodejs.org/en/), [Express](https://expressjs.com/) and [knex](https://knexjs.org/)
- storage: [PostgreSQL](https://www.postgresql.org/)
- TypeScript (used throughout the project).
- Frontend: React, TRPC, and Material UI.
- Backend: Node.js, Express, and Prisma.
- Database: PostgreSQL.

## V1 legacy
## V1 Legacy

Old celluloid version 1 that users Youtube videos still be found [here](https://github.com/celluloid-camp/celluloid/releases/tag/v1)
You can still find the old Celluloid version 1 that supports YouTube videos
[here](https://github.com/celluloid-camp/celluloid/releases/tag/v1).
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ volumes:
postgres:
redis:


services:
postgres:
image: postgres:11.3
image: postgres:13
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
Expand All @@ -23,7 +22,7 @@ services:
- "5432:5432"
restart: unless-stopped
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@babel/preset-env": "^7.14.2",
"@babel/preset-typescript": "^7.13.0",
"@types/jest": "^26.0.23",
"@types/swagger-ui-express": "^4.1.3",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"babel-jest": "^27.0.1",
Expand All @@ -57,12 +56,14 @@
"nodemon": "^2.0.22",
"prettier": "^2.3.0",
"rimraf": "^3.0.2",
"start-server-and-test": "^2.0.0",
"ts-jest": "^27.0.1",
"ts-loader": "^8.0.11",
"ts-node": "^10.0.0",
"tsup": "^5.11.13",
"tsx": "^3.7.1",
"typescript": "^5.0.4"
"tsx": "^3.12.10",
"typescript": "^5.0.4",
"wait-port": "^1.0.4"
},
"prettier": {
"trailingComma": "es5",
Expand Down
8 changes: 6 additions & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"type": "module",
"author": "Younes Benaomar <younes.benaomar@gmail.com>",
"license": "MIT",
"proxy": "http://localhost:3001",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand All @@ -23,7 +22,10 @@
"@mui/material": "^5.12.0",
"@mui/styles": "^5.12.0",
"@reduxjs/toolkit": "^1.8.6",
"@tanstack/react-query": "^4.14.1",
"@tanstack/react-query": "^4.35.3",
"@trpc/client": "^10.38.3",
"@trpc/react-query": "^10.38.3",
"@trpc/server": "^10.38.3",
"@types/linkify-urls": "^3.1.1",
"autosuggest-highlight": "^3.1.1",
"axios": "^1.3.4",
Expand All @@ -41,6 +43,8 @@
"material-ui-pickers": "^1.0.0-rc.17",
"moment-duration-format": "^2.2.2",
"mui-image": "^1.0.7",
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"prop-types": "^15.6.2",
"query-string": "^6.1.0",
"ramda": "^0.28.0",
Expand Down
Loading

0 comments on commit 38fa57d

Please sign in to comment.