Skip to content

PlsJustDoIt/ru_project

Repository files navigation

ru_project

Projet info ru.

exemple

alt text

DOC

Backend

fonctionnement des tokens

Getting Started

First, clone the project:

git clone https://github.com/PlsJustDoIt/ru_project.git

cd into the project directory:

cd ru_project

give permissions to the scripts:

chmod +x *.sh

Installation of backend

Run the install_backend.sh script:

./install_backend.sh

cron job

pwd # copy the path
crontab -e

add the following line:

0 0 * * MON /usr/bin/curl --silent -o {your path to ru_project}/backend/menus.xml 'http://webservices-v2.crous-mobile.fr:8080/feed/bfc/externe/menu.xml' &>/dev/null

MongoDB

Local installation

follow instructions after step 6 : https://thelinuxforum.com/articles/912-how-to-install-mongodb-on-ubuntu-24-04

create a database:

mongosh
use admin
db.createUser({
    user:"{your username}", 
    pwd:"password", 
    roles:[{role: "root", db:"admin"}]
    })

use the database:

use ru_project
db.createUser({
    user:"ru_project_user",
    pwd:"ru_project_password",
    roles:[{role: "readWrite", db:"ru_project"}]
    })

exit()

create a user with admin role:

# Generate a hashed password
node -e "console.log(require('bcrypt').hashSync('MySecretPassword', 10))"

# Copy the resulting hash and paste it below
mongosh
use ru_project
db.users.insertOne({
    username: "adminUser",
    password: "<PASTE_THE_HASH_HERE>",
    role: "admin"})
exit
env file

the following instructions are for development mode :

generate a JWT_ACCESS_SECRET with the following command:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

copy the key

repeat the operation for the JWT_REFRESH_SECRET.

add a .env file in the backend directory with the following content:

MONGO_URI="mongodb://ru_project_user:ru_project_password@127.0.0.1:27017/ru_project?authSource=ru_project"
JWT_ACCESS_SECRET="{your first generated key}"
JWT_REFRESH_SECRET="{your second generated key}"
GINKO_API_KEY="{your ginko api key}"

Install Flutter

run the install_flutter.sh script:

./install_flutter.sh

Now, open vs code and install the following extensions:

  • flutter
  • dart

and try to create a new flutter project, it will ask you to install the flutter sdk, install it in ~/development/.

finish the installation of flutter and dart plugins.

local installation

in flutter/lib/config.dart, configure the backend url:

    class config {
    static const String apiUrl = "http://localhost:5000/api";
}

Running the project

Backend

To run the backend, follow the instructions in the backend directory:

cd backend
npx tsx watch src/app.ts # watch allows you to restart the server when you save a file

Frontend

It is recommended to launch flutter with vs code, but you can also run it with the following commands:

flutter pub get
flutter run

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

About

This project provides a full-stack solution combining a Node/TypeScript back end, a Flutter front end, and MongoDB. It offers user authentication, an admin interface, and real-time features (e.g., chat), aiming to streamline bug reporting, data management, and overall app administration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors