From 68d425bc12f3fe55135d242b03f67075c7709f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Pi=C3=B1ones?= Date: Fri, 25 Apr 2025 12:42:29 -0300 Subject: [PATCH 1/4] wip add readme db --- app/README.md | 22 ++++++++++++++++++++++ app/api/.env.example | 15 +++++++-------- app/database/init.sql | 2 +- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/app/README.md b/app/README.md index 4dfaf3f0b..e1dcee23f 100644 --- a/app/README.md +++ b/app/README.md @@ -20,6 +20,20 @@ Our objective is to simplify the Starklings experience by eliminating complex co The backend of the Starklings App is responsible for handling data processing and interactions with the Starknet exercises. Follow these steps to set up and run the backend: +Si es la primera vez que se ejecuta el backend debes configurar la conexion a la base de datos: + +Necesitamos crear una tabla en la base de datos. En este caso estoy usando dbeaver para crear la conexion a postgres y luego crear la tabla. +(imagen creando la conexion en dbeaver) + +Una vez creada la conexion, debo crear una nueva query y ejecutar el archivo init.sql +(imagen ejecutando el archivo init.sql) + +Ya tenemos la tabla creada. + +Ahora debemos configurar el archivo .env. En mi caso voy a copiar y pegar el archivo .env.example. Pero ustedes deben poner los valores que correspondan. +(imagen del archivo .env) + +Ahora si, podemos ejecutar el backend: ```bash cd api/ ``` @@ -36,6 +50,14 @@ Run the development server: npm run dev ``` +Para probar la conexion a la base de datos, podemos usar el endpoint de ping: +```bash +curl http://localhost:3000/api/ping +``` + +Deberiamos ver una respuesta similar a esta: +(imagen de la respuesta del endpoint de ping) + ### Frontend The frontend is the user interface of the Starklings App, providing an interactive environment for users to engage with Cairo exercises. diff --git a/app/api/.env.example b/app/api/.env.example index b2ef56217..0d5a21844 100644 --- a/app/api/.env.example +++ b/app/api/.env.example @@ -1,8 +1,7 @@ -PG_PORT= -PG_HOST= -PG_USER= -PG_PASSWORD= -PG_DATABASE= -PG_DATABASE_SSL= -# ORIGIN= -URL_GITHUB_STARKLINGS= \ No newline at end of file +PG_PORT=5432 +PG_HOST=localhost +PG_USER=postgres +PG_PASSWORD=postgres +PG_DATABASE=starklings-test +PG_DATABASE_SSL=false +ORIGIN=* diff --git a/app/database/init.sql b/app/database/init.sql index d51db70fc..2d795fee4 100644 --- a/app/database/init.sql +++ b/app/database/init.sql @@ -1,7 +1,7 @@ CREATE TABLE Resolutions ( id SERIAL PRIMARY KEY, user_name VARCHAR(255), - exercise_id VARCHAR(255) REFERENCES Exercises(id), + exercise_id VARCHAR(255), resolution_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNIQUE (user_name, exercise_id) ); From eee17eaa62372d9bcd5e1f33e45cf9b9c2e8ae6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Pi=C3=B1ones?= Date: Fri, 25 Apr 2025 12:46:30 -0300 Subject: [PATCH 2/4] update README.md: improve database setup instructions and clarify backend running steps --- app/README.md | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/app/README.md b/app/README.md index e1dcee23f..701c85c8c 100644 --- a/app/README.md +++ b/app/README.md @@ -12,7 +12,6 @@ The Starklings App is an interactive web platform designed to assist users in em Our objective is to simplify the Starklings experience by eliminating complex configurations and installations. Simply access the app through your browser and begin coding. - ## Components ### Backend @@ -20,20 +19,16 @@ Our objective is to simplify the Starklings experience by eliminating complex co The backend of the Starklings App is responsible for handling data processing and interactions with the Starknet exercises. Follow these steps to set up and run the backend: -Si es la primera vez que se ejecuta el backend debes configurar la conexion a la base de datos: - -Necesitamos crear una tabla en la base de datos. En este caso estoy usando dbeaver para crear la conexion a postgres y luego crear la tabla. -(imagen creando la conexion en dbeaver) +#### Database Setup -Una vez creada la conexion, debo crear una nueva query y ejecutar el archivo init.sql -(imagen ejecutando el archivo init.sql) +If you're running the backend for the first time, you need to configure the database connection: -Ya tenemos la tabla creada. +1. Create a table in the database. This example uses DBeaver to create a connection to PostgreSQL and then create the table. +2. Once the connection is established, create a new query and execute the [init.sql](./database/init.sql) file. +3. After the table is created, configure the [.env](./api/.env) file. You can copy the [.env.example](./api/.env.example) file and modify it with your own values. -Ahora debemos configurar el archivo .env. En mi caso voy a copiar y pegar el archivo .env.example. Pero ustedes deben poner los valores que correspondan. -(imagen del archivo .env) +#### Running the Backend -Ahora si, podemos ejecutar el backend: ```bash cd api/ ``` @@ -50,13 +45,13 @@ Run the development server: npm run dev ``` -Para probar la conexion a la base de datos, podemos usar el endpoint de ping: +To test the database connection, you can use the ping endpoint: + ```bash curl http://localhost:3000/api/ping ``` -Deberiamos ver una respuesta similar a esta: -(imagen de la respuesta del endpoint de ping) +You should see a response indicating that the connection is working properly. ### Frontend From 680ad634ee4991fe2bebf3368ca20d66e86c4387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Pi=C3=B1ones?= <30808181+dpinones@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:50:12 -0300 Subject: [PATCH 3/4] Update README.md --- app/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/README.md b/app/README.md index 701c85c8c..5db825e8e 100644 --- a/app/README.md +++ b/app/README.md @@ -24,9 +24,18 @@ Follow these steps to set up and run the backend: If you're running the backend for the first time, you need to configure the database connection: 1. Create a table in the database. This example uses DBeaver to create a connection to PostgreSQL and then create the table. + + Screenshot 2025-04-25 at 12 14 54 PM + 2. Once the connection is established, create a new query and execute the [init.sql](./database/init.sql) file. + + Screenshot 2025-04-25 at 12 26 58 PM + 3. After the table is created, configure the [.env](./api/.env) file. You can copy the [.env.example](./api/.env.example) file and modify it with your own values. + Screenshot 2025-04-25 at 12 37 42 PM + + #### Running the Backend ```bash @@ -53,6 +62,8 @@ curl http://localhost:3000/api/ping You should see a response indicating that the connection is working properly. +Screenshot 2025-04-25 at 12 38 49 PM + ### Frontend The frontend is the user interface of the Starklings App, providing an interactive environment for users to engage with Cairo exercises. From 4e14210b233e40ebc0591be07104a62d57ea59b4 Mon Sep 17 00:00:00 2001 From: Shramee Srivastav Date: Thu, 24 Jul 2025 14:01:26 +0300 Subject: [PATCH 4/4] minor tweaks --- app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/README.md b/app/README.md index 5db825e8e..356879377 100644 --- a/app/README.md +++ b/app/README.md @@ -23,7 +23,7 @@ Follow these steps to set up and run the backend: If you're running the backend for the first time, you need to configure the database connection: -1. Create a table in the database. This example uses DBeaver to create a connection to PostgreSQL and then create the table. +1. Create a new database named `starklings-test`. This example uses DBeaver to create a connection to PostgreSQL and then create the database. Screenshot 2025-04-25 at 12 14 54 PM