English Content
# 1. Clone the repository and enter the folder git clone https://github.com/magdielcardoso/discuza.git cd discuza # 2. Run the automated setup make setup # 3. Configure credentials (required the first time) # Follow the instructions in the editor that opens. make credentials # 4. Start the server make start
Access the application at http://localhost:3000. See other useful commands with make help.
🚀 About Discuza
Discuza is a platform designed to facilitate online discussions in an organized and efficient way. Built with the robustness of Ruby on Rails and the interactivity of Hotwire (Turbo + Stimulus), it offers a fast and modern user experience.
✨ Key Features (Planned)
- Discussion Topic Creation
- Nested Reply System
- Post Reactions
- User Authentication (Devise)
- User Profiles
- Real-time Notifications (Action Cable)
- Markdown Support in Messages
- Efficient Search
📸 Screenshots
See what Discuza looks like:
Login Page
Main Dashboard
🛠️ Running Locally (Manual Steps)
Follow these steps to set up the development environment manually (alternative to make setup):
-
Clone the repository:
git clone https://github.com/magdielcardoso/discuza.git cd discuza -
Install dependencies:
- Make sure you have the correct Ruby version installed (check
.ruby-version). Use a manager likerbenvorrvm. - Install Bundler:
gem install bundler - Install gems and dependencies (includes JS via importmap and Tailwind):
bundle install
- Make sure you have the correct Ruby version installed (check
-
Configure the Database:
- Make sure you have PostgreSQL installed and running.
- Check the
config/database.ymlfile. Database credentials (user, password, host) must be configured, preferably using environment variables (see step 5). - Create the database:
rails db:create - Run migrations:
rails db:migrate - (Optional) Populate with initial data:
rails db:seed(ifdb/seeds.rbis configured).
-
Configure Credentials:
- Generate your own local
config/master.keyandconfig/credentials.yml.encfiles. These files are ignored by Git.
bin/rails credentials:edit
- Add any secrets needed for development in the editor that opens (or leave it empty if none are needed locally).
- Generate your own local
-
Configure Environment Variables:
- Copy the example file (if it exists):
cp .env.example .env - Edit the
.envfile and fill in the necessary variables (API keys, etc.). If.env.exampledoes not exist, create.envas needed for your application's settings (e.g., external service credentials).
- Copy the example file (if it exists):
-
Start the Server:
# Use the Procfile to start the processes (Rails server, Tailwind watch) ./bin/devAccess the application at
http://localhost:3000. -
Configure Git Hooks (Recommended):
- The project includes a pre-commit hook to run RuboCop automatically.
- Ensure it's configured by running the setup script (if you haven't already via
make setupor manual full setup):
./bin/setup --skip-server
- Or, configure it manually:
chmod +x script/git-hooks/pre-commit git config core.hooksPath script/git-hooks
-
Running Tests:
# Run all tests rails test
🤖 AI Development (StanDev)
This project uses an AI Coding Agent (StanDev) to accelerate development. To collaborate effectively:
### System Prompt Summary (StanDev) * **Prioritize Rails Generators:** Use `rails g` whenever possible (scaffold, model, controller, migration, etc.). * **Test Everything:** No features without tests (`rails g test_unit:..`). * **Document Progress:** Update `standev/app_progress.md`. * **Vanilla Rails:** Avoid external gems unless necessary; use ActiveRecord, ActiveStorage, Mailer, Jobs, Turbo/Stimulus. * **ERB Partials:** Use partials (`_partial.html.erb`) to organize views. * **Simplicity:** Lightweight controllers, logic in models/services, focus on incremental delivery.
- Follow Guidelines: The AI follows internally defined guidelines (you can consult them in our chat or in a dedicated file like
standev/README_AGENT.md, if created). - Review Progress: The
standev/app_progress.mdfile (if it exists) is updated by the AI with task status. Review it regularly. If it doesn't exist, ask the AI to create it. - Focus on Clear Tasks: When requesting features, provide clear and objective instructions. The AI prioritizes Rails generators and tests.
- Atomic Commits: The AI will try to make small, focused commits. Review Pull Requests or proposed changes.
🤝 How to Contribute
We are an open-source project and would love your help!
- Fork the project.
- Create a Branch for your feature (
git checkout -b feature/MyFeature). - Commit your changes (
git commit -m 'Add some MyFeature'). - Push to the Branch (
git push origin feature/MyFeature). - Open a Pull Request.
Please make sure your tests pass and follow the project's code style.
📄 License
This project is licensed under the MIT License. See the LICENSE file for more details.
✨ Acknowledgements
- To the Ruby on Rails community.
- To the project contributors.
🚀 Deploying with Kamal
This project is configured for continuous deployment using Kamal. Follow these basic steps to deploy:
-
Configure Servers:
- Ensure you have one or more servers (VMs) accessible via SSH with Docker installed.
-
Prepare Deploy File:
- Copy the example file:
cp config/deploy.yml.example config/deploy.yml - Review and adjust the new
config/deploy.ymlfile with your server details (IPs/hostnames), Docker image name, your domain, etc. Remember this file should not be committed (it's in.gitignore).
- Copy the example file:
-
Prepare Secrets File:
- Copy or rename the example file:
cp .kamal/secrets.example .kamal/secrets - This file must contain the credentials needed for deployment, such as:
KAMAL_REGISTRY_PASSWORD: Password for your Docker registry (e.g., Docker Hub PAT).RAILS_MASTER_KEY: The content of yourconfig/master.keyfile.DATABASE_PASSWORDorPOSTGRES_PASSWORD: Database password, if applicable and configured indeploy.yml.
- Edit the new
.kamal/secretsfile and fill in your actual credentials. - Security: Ideally, pull these secrets from a password manager or environment variables, as suggested in the example file's comments. Do not commit the
.kamal/secretsfile to Git if it contains real passwords. (Add.kamal/secretsto your.gitignore).
- Copy or rename the example file:
-
Initial Setup (First time):
- Run setup to install Traefik, configure Docker, etc., on the servers.
-
Deploy:
- Run deploy to build the image, push it, and start/update the containers.
-
Useful Commands:
kamal details: View configuration details.kamal logs: View application logs.kamal app exec 'bin/rails c': Open Rails console on the server.kamal traefik --help: Commands for managing Traefik.kamal accessory --help: Commands for managing accessories (e.g., database).
---
Conteúdo em Português
# 1. Clone o repositório e entre na pasta git clone https://github.com/magdielcardoso/discuza.git cd discuza # 2. Rode o setup automatizado make setup # 3. Configure as credenciais (necessário na primeira vez) # Siga as instruções no editor que abrir. make credentials # 4. Inicie o servidor make start
Acesse a aplicação em http://localhost:3000. Veja outros comandos úteis com make help.
🚀 Sobre o Discuza
Discuza é uma plataforma projetada para facilitar discussões online de forma organizada e eficiente. Construída com a robustez do Ruby on Rails e a interatividade do Hotwire (Turbo + Stimulus), oferecendo uma experiência de usuário rápida e moderna.
✨ Funcionalidades Principais (Planejadas)
- Criação de Tópicos de Discussão
- Sistema de Respostas Aninhadas
- Reações a Posts
- Autenticação de Usuários (Devise)
- Perfis de Usuário
- Notificações em Tempo Real (Action Cable)
- Markdown Suportado nas Mensagens
- Busca Eficiente
📸 Screenshots
Veja como o Discuza se parece:
Página de Login
Dashboard Principal
🛠️ Rodando Localmente (Passos Manuais)
Siga estes passos para configurar o ambiente de desenvolvimento manualmente (alternativa ao make setup):
-
Clone o repositório:
git clone https://github.com/magdielcardoso/discuza.git cd discuza -
Instale as dependências:
- Certifique-se de ter a versão correta do Ruby instalada (verifique
.ruby-version). Use um gerenciador comorbenvourvm. - Instale o Bundler:
gem install bundler - Instale as gems e dependências (inclui JS via importmap e Tailwind):
bundle install
- Certifique-se de ter a versão correta do Ruby instalada (verifique
-
Configure o Banco de Dados:
- Certifique-se de ter o PostgreSQL instalado e rodando.
- Verifique o arquivo
config/database.yml. As credenciais do banco de dados (usuário, senha, host) devem ser configuradas, preferencialmente usando variáveis de ambiente (ver passo 5). - Crie o banco de dados:
rails db:create - Rode as migrações:
rails db:migrate - (Opcional) Popule com dados iniciais:
rails db:seed(sedb/seeds.rbestiver configurado).
-
Configure as Credenciais:
- Gere seus próprios arquivos locais
config/master.keyeconfig/credentials.yml.enc. Estes arquivos são ignorados pelo Git.
bin/rails credentials:edit
- Adicione quaisquer segredos necessários para desenvolvimento no editor que abrir (ou deixe vazio se nenhum for necessário localmente).
- Gere seus próprios arquivos locais
-
Configure Variáveis de Ambiente:
- Copie o arquivo de exemplo (se existir):
cp .env.example .env - Edite o arquivo
.enve preencha as variáveis necessárias (chaves de API, etc.). Se.env.examplenão existir, crie.envconforme necessário para as configurações da sua aplicação (ex: credenciais de serviços externos).
- Copie o arquivo de exemplo (se existir):
-
Inicie o Servidor:
# Use o Procfile para iniciar os processos (Rails server, Tailwind watch) ./bin/devAcesse a aplicação em
http://localhost:3000. -
Configure os Git Hooks (Recomendado):
- O projeto inclui um hook de pre-commit para rodar o RuboCop automaticamente.
- Garanta que esteja configurado executando o script de setup (se ainda não o fez via
make setupou setup manual completo):
./bin/setup --skip-server
- Ou configure manualmente:
chmod +x script/git-hooks/pre-commit git config core.hooksPath script/git-hooks
-
Rodando os Testes:
# Rode todos os testes rails test
🤖 Desenvolvimento com IA (StanDev)
Este projeto utiliza uma IA Agente de Codificação (StanDev) para acelerar o desenvolvimento. Para colaborar efetivamente:
### Resumo do System Prompt (StanDev) * **Priorize Geradores Rails:** Use `rails g` sempre que possível (scaffold, model, controller, migration, etc.). * **Teste Tudo:** Nenhuma funcionalidade sem testes (`rails g test_unit:..`). * **Documente o Progresso:** Atualize `standev/app_progress.md`. * **Rails Vanilla:** Evite gems externas sem necessidade; use ActiveRecord, ActiveStorage, Mailer, Jobs, Turbo/Stimulus. * **Partials ERB:** Use parciais (`_partial.html.erb`) para organizar as views. * **Simplicidade:** Controllers leves, lógica nos models/services, foco em entrega incremental.
- Siga as Diretrizes: A IA segue as diretrizes definidas internamente (você pode consultá-las na nossa conversa ou em um arquivo dedicado como
standev/README_AGENT.md, se criado). - Revise o Progresso: O arquivo
standev/app_progress.md(se existir) é atualizado pela IA com o status das tarefas. Revise-o regularmente. Se não existir, peça para a IA criá-lo. - Foco em Tarefas Claras: Ao solicitar funcionalidades, forneça instruções claras e objetivas. A IA prioriza geradores Rails e testes.
- Commits Atômicos: A IA tentará fazer commits pequenos e focados. Revise os Pull Requests ou as alterações propostas.
🤝 Como Contribuir
Somos um projeto open-source e adoraríamos sua ajuda!
- Faça un Fork do projeto.
- Crie uma Branch para sua feature (
git checkout -b feature/MinhaFeature). - Faça commit de suas alterações (
git commit -m 'Add some MyFeature'). - Faça push para a Branch (
git push origin feature/MyFeature). - Abra um Pull Request.
Por favor, certifique-se de que seus testes passam e siga o estilo de código do projeto.
📄 Licença
Este projeto está licenciado sob a Licença MIT. Veja o arquivo LICENSE para mais detalhes.
✨ Agradecimentos
- À comunidade Ruby on Rails.
- Aos contribuidores do projeto.
🚀 Deploy com Kamal
Este projeto está configurado para deploy contínuo usando Kamal. Siga os passos básicos para fazer deploy:
-
Configure os Servidores:
- Certifique-se de ter um ou mais servidores (VMs) acessíveis via SSH com Docker instalado.
-
Prepare o Arquivo de Deploy:
- Copie o arquivo de exemplo:
cp config/deploy.yml.example config/deploy.yml - Revise e ajuste o novo arquivo
config/deploy.ymlcom os detalhes dos seus servidores (IPs/hostnames), nome da imagem Docker, seu domínio, etc. Lembre-se que este arquivo não deve ser commitado (está no.gitignore).
- Copie o arquivo de exemplo:
-
Prepare o Arquivo de Segredos:
- Copie ou renomeie o arquivo de exemplo:
cp .kamal/secrets.example .kamal/secrets - Este arquivo deve conter as credenciais necessárias para o deploy, como:
KAMAL_REGISTRY_PASSWORD: Senha para o seu registry Docker (ex: Docker Hub PAT).RAILS_MASTER_KEY: O conteúdo do seu arquivoconfig/master.key.DATABASE_PASSWORDouPOSTGRES_PASSWORD: Senha do banco de dados, se aplicável e configurada nodeploy.yml.
- Edite o novo arquivo
.kamal/secretse preencha com suas credenciais reais. - Segurança: Idealmente, puxe esses segredos de um gerenciador de senhas ou variáveis de ambiente, conforme sugerido nos comentários do arquivo de exemplo. Não comite o arquivo
.kamal/secretsno Git se ele contiver senhas reais. (Adicione.kamal/secretsao seu.gitignore).
- Copie ou renomeie o arquivo de exemplo:
-
Setup Inicial (Primeira vez):
- Execute o setup para instalar Traefik, configurar Docker, etc., nos servidores.
-
Deploy:
- Execute o deploy para buildar a imagem, fazer push e iniciar/atualizar os contêineres.
-
Comandos Úteis:
kamal details: Ver detalhes da configuração.kamal logs: Ver logs da aplicação.kamal app exec 'bin/rails c': Abrir console Rails no servidor.kamal traefik --help: Comandos para gerenciar o Traefik.kamal accessory --help: Comandos para gerenciar acessórios (ex: banco de dados).

