Skip to content

Commit

Permalink
Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
guillecro committed Dec 12, 2024
0 parents commit 47a7d86
Show file tree
Hide file tree
Showing 71 changed files with 7,713 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# VSCode
.vscode

# Github
.github

# Others
node_modules
.env
16 changes: 16 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NODE_ENV=development # For production, set to "production"
APP_URL=http://localhost:4000 # For multiple domains, separate them with comma
JWT_SECRET=THisIsMySecretKey! # For production, set to a long random string
PORT=3000
SEND_NOTIFICATIONS=true
# DEFAULT_TIMEZONE=America/Argentina/Buenos_Aires # Default timezone for the app
# DATABASE_NAME=movilizatorio
# DATABASE_USERNAME=root
# DATABASE_PASSWORD=root
# DATABASE_HOST=127.0.0.1
# DATABASE_PORT=3306
# MAILER_FROM="My Org APP <[email protected]>"
# MAILER_HOST=sandbox.smtp.mailtrap.io
# MAILER_PORT=2525
# MAILER_USER=user
# MAILER_PASSWORD=password
31 changes: 31 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# version 1.0
name: Build and push
on:
push:
tags:
- '*'

jobs:
work:
name: Work
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Lowercase
id: lower
uses: ASzc/change-string-case-action@v1
with:
string: ${{ github.repository }}
- name: Build & Push docker image
uses: mr-smithers-excellent/docker-build-push@v4
with:
image: ${{ steps.lower.outputs.lowercase }}
registry: ghcr.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Notify Slack
uses: craftech-io/slack-action@v1
with:
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
if: always()
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.env
.env.*
!.env.example
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.11.0
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Node.js runtime as the base image
FROM node:22-alpine

# Set the working directory in the Docker image
WORKDIR /usr/src/app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install the application dependencies
RUN npm install

# Copy the rest of the application code to the working directory
COPY . .

# Expose port 3000 for the application
EXPOSE 3000

# Define the command to run the application
CMD [ "npm", "start" ]
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Incidir Para Existir - Backend

## Overview
This repository contains the backend code for the "Incidir Para Existir" project. The backend is responsible for handling API requests, managing the database, and providing data to the frontend.

## Technologies Used
- Node.js
- Express.js
- MySQL 8
- Sequelize ORM

## Getting Started

### Prerequisites
- Node.js (v14 or higher)
- MySQL 8

### Installation
1. Clone the repository:
```bash
git clone https://github.com/yourusername/incidir-para-existir.git
```
2. Navigate to the backend directory:
```bash
cd incidir-para-existir/backend
```
3. Install dependencies:
```bash
npm install
```
### Preparing the database

```sql
CREATE DATABASE production_movilizatorio
CHARACTER SET utf8mb4
COLLATE utf8mb4_general_ci;
```

```sql
CREATE USER 'production_movilizatorio'@'%' IDENTIFIED BY 'YourStrongPassword';
```

```sql
GRANT ALL PRIVILEGES ON production_movilizatorio.* TO 'production_movilizatorio'@'%';
```

```sql
FLUSH PRIVILEGES;
```

### Configuration

Copy the `.env.example` file to `.env` and update the values as needed.

### Running the Application
1. Start the development server:
```bash
npm run dev
```
2. The server will be running at `http://localhost:3000`. (In case you have changed the port number, the server will be running at `http://localhost:your_port_number`)

#### If you need a docker mysql database

You can execute this to get a quick mysql database running:

```bash
docker run -d --name mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -v ~/databases/mysql8:/var/lib/mysql mysql:8
```

Make sure to change the password and the volume path to your needs.

## Contributing
Contributions are welcome! Please fork the repository and create a pull request with your changes.
9 changes: 9 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"development": {
"username": "root",
"password": "root",
"database": "movilizatorio",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
26 changes: 26 additions & 0 deletions config/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
development:{
dialect: 'mysql',
database: process.env.DATABASE_NAME || 'movilizatorio',
username: process.env.DATABASE_USERNAME || 'root',
password: process.env.DATABASE_PASSWORD || 'root',
host: process.env.DATABASE_HOST || 'localhost',
port: parseInt(process.env.DATABASE_PORT || '3306'),
logging: console.log,
},
production: {
dialect: 'mysql',
database: process.env.DATABASE_NAME || 'movilizatorio',
username: process.env.DATABASE_USERNAME || 'root',
password: process.env.DATABASE_PASSWORD || 'root',
host: process.env.DATABASE_HOST || 'localhost',
port: parseInt(process.env.DATABASE_PORT || '3306'),
logging: false,
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
}
}
Loading

0 comments on commit 47a7d86

Please sign in to comment.