<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Raphael Almeida Araújo on Medium]]></title>
        <description><![CDATA[Stories by Raphael Almeida Araújo on Medium]]></description>
        <link>https://medium.com/@raphox?source=rss-754d3f9e2e50------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*h7LZTfbHhF7qL07B.</url>
            <title>Stories by Raphael Almeida Araújo on Medium</title>
            <link>https://medium.com/@raphox?source=rss-754d3f9e2e50------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 21:32:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raphox/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Solicitar histórico escolar em Alberta, Canadá, válido no Brasil]]></title>
            <link>https://medium.com/@raphox/solicitar-hist%C3%B3rico-escolar-em-alberta-canad%C3%A1-v%C3%A1lido-no-brasil-740b3c38200f?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/740b3c38200f</guid>
            <category><![CDATA[alberta]]></category>
            <category><![CDATA[imigrantes]]></category>
            <category><![CDATA[schools]]></category>
            <category><![CDATA[histórico-escolar]]></category>
            <category><![CDATA[student-records]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 17:58:24 GMT</pubDate>
            <atom:updated>2026-02-11T17:58:24.180Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Como Solicitar, Autenticar e Apostilar um Histórico Escolar de Alberta (Canadá) para Uso no Brasil e em mais de 110 outrso países.</blockquote><p>Muitas famílias brasileiras que moraram no Canadá acabam retornando ao Brasil e precisam apresentar o histórico escolar dos filhos para matrícula em escolas brasileiras. O processo pode parecer confuso no início, pois envolve várias etapas: solicitar o documento, autenticá-lo e, depois, apostilar.</p><p>Neste guia, vou explicar todo o passo a passo, de forma simples e detalhada, para ajudar quem está passando por isso.</p><h3>📌 Visão Geral do Processo</h3><p>Basicamente, você precisará:</p><ul><li>Solicitar o histórico escolar na escola ou no distrito escolar em Alberta</li><li>Autenticar o documento em Alberta</li><li>Enviar o documento para apostilamento em Edmonton</li><li>Traduzir o documento (quando necessário)</li><li>Apresentar no Brasil</li></ul><blockquote><strong>🙋 Minha experiência pessoal: </strong>Eu ouvi relatos de que há escolas que só geram o historico escolar após o aluno deixar de frequentar a escolar. Mas há relatos de alunos que frequentaram a escola depois de pedir o histórico até a data da mudança.</blockquote><h3>🏫 Passo 1 — Solicitar o Histórico Escolar em Alberta</h3><h4>✔️ Onde solicitar?</h4><p>Normalmente, você pode solicitar o histórico diretamente:</p><ul><li>Na escola onde o aluno estudou</li><li>No <strong>School District (Distrito Escolar)</strong> responsável pela escola</li></ul><p>Em Alberta, cada região possui seu próprio distrito escolar.</p><p><strong>👉 Exemplos:</strong></p><ul><li>Calgary Board of Education (CBE)</li><li>Edmonton Public Schools</li><li>Elk Island Public Schools</li><li>Rocky View Schools</li><li>Outros distritos regionais</li></ul><h4>✔️ Como solicitar?</h4><p><strong>Opção 1 — Diretamente com a escola</strong></p><p>Entre em contato com o escritório administrativo da escola e solicite:</p><ul><li><strong>Official Transcript ou Student Record</strong></li></ul><p>Algumas escolas podem emitir diretamente ou encaminhar para o distrito.</p><blockquote><strong>🙋 Minha experiência pessoal:</strong> Eu optei por enviar uma mensagem de email para o endereço que tinha de contato com o professor. Veja o email que mandei pra eles <a href="https://docs.google.com/document/d/151cdiG0xw-m-Fpn5kYsxIDUIdXdkYm1_kW3kFovYxEU/edit?usp=sharing">aqui</a>. O professor enviou os documentos impressos e assinados através do meu filho.</blockquote><p><strong>Opção 2 — Pelo Distrito Escolar</strong></p><p>A maioria dos distritos possui um formulário online para solicitações.</p><p>Normalmente será necessário:</p><ul><li>Nome completo do aluno</li><li>Data de nascimento</li><li>Período em que estudou</li><li>Nome da escola</li><li>Documento de identificação</li></ul><blockquote><strong>⚠️ Importante: </strong><br>Peça sempre o documento como <strong>Official Transcript</strong> ou <strong>Certified Student Record</strong>.</blockquote><h4>✔️ Formato do documento</h4><p>O histórico geralmente pode ser:</p><ul><li>Digital (PDF oficial)</li><li>Impresso e carimbado/assinado</li></ul><blockquote><strong>🙋 Minha experiência pessoal:</strong> Depois de solicitado, eu recebi impresso e assinado.</blockquote><p>Para apostilamento, normalmente é necessário:</p><ul><li>👉 Documento original</li><li>👉 Assinatura oficial</li><li>👉 Carimbo institucional</li></ul><h3><strong>🖋️ Passo 2 — Autenticar o Documento em Alberta</strong></h3><p>Antes do apostilamento, o documento precisa ser autenticado.</p><h4>✔️ O que é autenticação?</h4><p>É o processo que confirma que:</p><ul><li>A assinatura no documento é válida</li><li>O documento foi emitido por autoridade oficial</li></ul><h4>✔️ Onde autenticar em Alberta?</h4><p>Você deve levar o histórico que a escola lhe entregou ao:</p><p><strong>🔹 Notary Public</strong></p><p>Eles são responsáveis por validar documentos oficiais.</p><p>Normalmente eles verificam:</p><ul><li>Assinatura</li><li>Cargo da pessoa que assinou</li><li>Validade institucional</li></ul><blockquote><strong>🙋 Minha experiência pessoal:</strong> Eu fui pessoalmente à um dos muitos Notary Public que existem em Alberta. Eu solicitei apenas a autenticação do histórico escolar. Você vai pagar por documento. Você vai economizar se não autenticar carta de recomendação ou outros documentos.</blockquote><h4>✔️ O que levar?</h4><p>Geralmente:</p><ul><li>Documento original</li><li>Taxa de serviço</li></ul><blockquote><strong>💡 Dica:</strong> Entre em contato por email ou telefone para confirmar se há exigências atualizadas.</blockquote><h3>🌎 Passo 3 — Apostilar o Documento em Edmonton</h3><h4>✔️ O que é Apostila (ou Apostille)?</h4><p>A apostila segue a <a href="https://www.gov.br/mre/pt-br/embaixada-windhoek/consular/perguntas-e-respostas/apostilamento-apostila-da-haia">Convenção de Haia</a>, que permite que documentos canadenses tenham validade internacional — inclusive no Brasil.</p><h4>✔️ Onde apostilar em Alberta?</h4><p>Desde que o Canadá aderiu à Convenção de Haia, Alberta passou a emitir apostilas oficialmente.</p><p>O apostilamento normalmente é feito através do governo provincial.</p><p>👉 O processo geralmente ocorre em Edmonton, pois é onde ficam os principais escritórios governamentais.</p><h4>✔️ Processo Geral</h4><p>Após autenticar o documento:</p><ol><li>Preencha o formulário de apostila <a href="https://www.alberta.ca/document-authentication-other-jurisdictions-countries#jumplinks-2">https://www.alberta.ca/document-authentication-other-jurisdictions-countries#jumplinks-2</a></li><li>Pague a taxa correspondente <a href="https://eservices.alberta.ca/certificates-of-apostille.html">https://eservices.alberta.ca/certificates-of-apostille.html</a></li><li>Envie no envelope ao Official Documents &amp; Appointments:<br>- Destinatário:<br> <em>Official Documents and Appointments<br> #111, 9833 109 Street<br> Edmonton, Alberta T5K 2E8</em><br><strong><em>*** Confirme o endereço no </em></strong><a href="https://www.alberta.ca/document-authentication-other-jurisdictions-countries#jumplinks-2"><strong><em>site</em></strong></a><strong><em>. Busque por &#39;Mailing and courier address&#39;.</em></strong><br>- O documento autenticado que você gerou no Notary Public. Não envie os originais que você recebeu da escola.<br>- O formulário de requisição do Apostille (Request Apostille Form)<br>- O comprovante de pagamento da taxa (eServices proof of payment)<br>- Envelope extra que será utilizado para envio dos documentos com o Apostille</li><li>Aguarde o processamento</li><li>Receba o documento apostilado</li></ol><blockquote><strong>🙋 Minha experiência pessoal: </strong>Esse é um procedimento muito comum e até o funcionário dos correios sobou me orientar sobre qual envolepe utilizar para enviar e qual envelope despachar para receber os documentos de volta. No caso, foram os mesmos envelopes.</blockquote><blockquote>Como eu estava de saída do país, eu coloquei o endereço da casa de um amigo como endereço de retorno e remetente. Seria arriscado se colocasse o endereço da casa de onde estava me mudando e não estar lá para receber.</blockquote><h4>✔️ Tempo médio</h4><p>Pode variar, mas normalmente:</p><ul><li>Algumas semanas por correio</li><li>Mais rápido via atendimento presencial ou courier</li></ul><h3>📦 Passo 4 — Receber e Conferir o Documento</h3><p>Quando receber o documento:</p><ul><li>✅ Verifique se possui a apostila anexada</li><li>✅ Confirme se nomes e datas estão corretos</li><li>✅ Confira se todos os anos escolares estão listados</li></ul><h3>🇧🇷 Passo 5 — Tradução Juramentada no Brasil</h3><p>O Brasil normalmente exige tradução juramentada.</p><p>Você deve:</p><ol><li>Levar o documento apostilado</li><li>Contratar um tradutor público juramentado</li><li>Guardar original + tradução</li></ol><blockquote><strong>🙋 Minha experiência pessoal:</strong> Eu levei os documentos autenticados originais direto na escola. A escola do meu filho não me pediu para traduzir. Economizei um bom valor fazendo isso.</blockquote><h3>🏫 Passo 6 — Apresentar na Escola Brasileira</h3><p>Com o documento apostilado e traduzido:</p><ul><li>Entre em contato com a escola brasileira</li><li>Algumas escolas solicitam equivalência de estudos</li><li>Em certos casos, a Secretaria de Educação pode analisar o histórico</li></ul><h3>💡 Dicas Importantes</h3><h4>✔️ Solicite mais de uma via</h4><p>Pode evitar dor de cabeça no futuro.</p><h4>✔️ Guarde cópias digitais</h4><p>Sempre útil em processos escolares.</p><h4>✔️ Comece o processo cedo</h4><p>Algumas etapas podem demorar semanas.</p><h4>✔️ Confirme exigências da escola no Brasil</h4><p>Cada instituição pode pedir documentos adicionais.</p><h3>❓ Perguntas Frequentes</h3><h4>Preciso apostilar documentos digitais?</h4><p>Na maioria dos casos, será necessário o documento físico.</p><h4>Posso pedir o histórico depois que sair do Canadá?</h4><p>Sim. Normalmente o distrito escolar consegue emitir remotamente.</p><h4>Crianças do ensino fundamental também precisam?</h4><p>Sim, principalmente para comprovar a escolaridade no Brasil.</p><h3>❤️ Conclusão</h3><p>Embora o processo tenha várias etapas, ele é totalmente possível de ser feito com organização e antecedência.</p><p>Muitas famílias passam por esse caminho ao retornar ao Brasil, e entender cada fase ajuda a evitar atrasos na matrícula escolar.</p><p>Se você estiver passando por esse processo, respire fundo, siga cada etapa e tudo dará certo!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=740b3c38200f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recurring technology events in Calgary, AB, Canada]]></title>
            <link>https://medium.com/@raphox/recurring-technology-events-in-calgary-ab-canada-5ef6a309ad5e?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ef6a309ad5e</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[events]]></category>
            <category><![CDATA[calgary-alberta]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Wed, 08 Jan 2025 20:48:28 GMT</pubDate>
            <atom:updated>2025-01-08T20:48:28.761Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re living in or passing through Calgary and work or plan to work in the technology sector, you might want to attend one of the events I’ve listed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hl4oHQ_3wFAhnS3KcmClkg.jpeg" /></figure><p>Over the last few days, I’ve set out to attend several face-to-face technology events in Calgary. It was an excellent opportunity to get to know people and trends. My main focus was networking, but I acquired many other things. I had a lot of fun with the enthusiastic people who wanted to share knowledge and those who were interested in listening.</p><p>I will share with you how it went to invite more people to participate in these events. Most of them are recurring and free of charge.</p><ol><li><strong>Calgary Tech Talks</strong> <a href="https://www.meetup.com/calgary-tech-talks1/?eventOrigin=event_home_page">https://www.meetup.com/calgary-tech-talks1/?eventOrigin=event_home_page</a><br>It’s highly specialized content, precisely what I’ve been looking for. Learning about trends, or how different people solve the same problems, is very interesting. There are Brazilians, but the majority are of other nationalities.</li><li><strong>Calgary BR Tech</strong> <a href="https://www.meetup.com/calgary-br-tech/?eventOrigin=event_home_page">https://www.meetup.com/calgary-br-tech/?eventOrigin=event_home_page</a><br>An event in Portuguese. If I understand correctly, this is an event aimed at job seekers. There, you’ll find talks on how to improve your CV and where and how to find vacancies.</li><li><strong>YYC Dev Social | Bring Your Laptop and Code </strong><a href="https://www.meetup.com/yyc-dev/?eventOrigin=event_home_page">https://www.meetup.com/yyc-dev/?eventOrigin=event_home_page</a><br>For those who not only want to learn but also want to drink and eat, this is a great opportunity. I didn’t see any clear organization of how the event should be. The only two days I went, we sat at a table in the bar and shared curiosities about web development with Ruby and Python. But there were few people. But I think that’s the idea, to chat about anything related to development.</li><li><strong>Calgary Elixir Meetup </strong><a href="https://www.meetup.com/elixir-calgary/?eventOrigin=event_home_page">https://www.meetup.com/elixir-calgary/?eventOrigin=event_home_page</a><br>So far, it’s been the best-organized event, and most people are excited about learning something specific that I’ve been to here in Calgary. I think people are more excited and curious because the group&#39;s theme is a little-known language with great potential. Bringing together experts in the language with people wanting to learn, the discussion became lively.</li><li><strong>Project-based Mini-Hackathon!</strong> <a href="https://www.meetup.com/software-developers-of-calgary/?eventOrigin=event_home_page">https://www.meetup.com/software-developers-of-calgary/?eventOrigin=event_home_page</a><br>This was the place I’ve spoken to the most so far. I had the fortunate opportunity to reach a group of people who didn’t have much to talk about but were very interested in listening (even though I’m not a fluent speaker). The idea of the group is that whoever wants to present their project. After everyone has given their ideas, anyone who doesn’t have an idea can find a project and join the others who like the same idea. It’s a hands-on event where you can learn or teach. It was the most fun I’ve had so far.</li><li><strong>Association of Brazilian Students</strong> <a href="https://brasa.org/">https://brasa.org/</a><br>BRASA held an event at the University of Calgary called ‘Conecta’. An event in Portuguese brought together students, entrepreneurs, and experts from the Technology area and other markets. I went to an exciting event about market trends and a vibrant source of knowledge. The speakers were high-ranking people from major companies present in Calgary. These included Microsoft, KPMG, the City of Calgary, and Imperial Oil.</li></ol><p>If you also offer or know of an event you’d like to share, feel free to do so in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ef6a309ad5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My new side-project (next-rails-scaffold)]]></title>
            <link>https://medium.com/@raphox/my-new-side-project-next-rails-scaffold-6f78e914a4e4?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f78e914a4e4</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Sat, 11 Nov 2023 20:22:40 GMT</pubDate>
            <atom:updated>2023-11-16T21:44:22.400Z</atom:updated>
            <content:encoded><![CDATA[<p>Continuing my series of posts to evangelize the use of Rails with Nextjs, I’m creating a new project: <a href="https://github.com/raphox/next-rails-scaffold">https://github.com/raphox/next-rails-scaffold</a></p><p>With a single command, you can create all the routes and components needed for a CRUD.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/0*VY0xoasfbYjoQxof" /></figure><p>I hope more people will be interested in the project and can help me give Ruby developers a reason to overcome their fear of Javascript.</p><p>I also hope to bring you more news soon. The project has only just begun.</p><h3>Updated November 16th</h3><p>🚀 Exciting news, folks! 🌟 Just launched my latest app powered by the game-changing <a href="https://lnkd.in/eivyJ-8Q">https://lnkd.in/eivyJ-8Q</a> gem! 🔥 Dive into the seamless fusion of Next.js and Rails at <a href="https://lnkd.in/exggAbAU">https://lnkd.in/exggAbAU</a> 🌐 ✨ Brace yourselves for a web experience like no other!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f78e914a4e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Google Firebase Firestore with ChatGPT API — Opensource project]]></title>
            <link>https://medium.com/@raphox/integrating-google-firebase-firestore-with-chatgpt-api-opensource-project-c20e627f0088?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/c20e627f0088</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ionic]]></category>
            <category><![CDATA[gpt]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Thu, 17 Aug 2023 14:43:47 GMT</pubDate>
            <atom:updated>2023-08-17T14:43:47.278Z</atom:updated>
            <content:encoded><![CDATA[<h3>Integrating Google Firebase Firestore with ChatGPT API — Opensource project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*Bf6oMQ94CxuI-wliRWRGtA.png" /></figure><p>I didn’t get rich from my AI project, so I’m making it publicly available on Github <a href="https://github.com/raphox/guruduno.">https://github.com/raphox/guruduno.</a></p><p>Learn more about it at:</p><ul><li><a href="https://medium.com/@raphox/trying-to-maintain-a-workable-budget-creating-a-chatbot-using-gpt-and-vector-database-a04931040698">https://medium.com/@raphox/trying-to-maintain-a-workable-budget-creating-a-chatbot-using-gpt-and-vector-database-a04931040698</a></li><li><a href="https://medium.com/@raphox/integrating-google-firebase-firestore-with-chatgpt-api-saving-money-a90148e619b9">https://medium.com/@raphox/integrating-google-firebase-firestore-with-chatgpt-api-saving-money-a90148e619b9</a></li><li><a href="https://medium.com/@raphox/integrating-google-firebase-firestore-with-chatgpt-api-the-frontend-3178045c5ae7">https://medium.com/@raphox/integrating-google-firebase-firestore-with-chatgpt-api-the-frontend-3178045c5ae7</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c20e627f0088" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails and Next.js: the perfect combination for modern web development (Final part)]]></title>
            <link>https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-final-part-a88af492a00?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/a88af492a00</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Wed, 09 Aug 2023 19:50:46 GMT</pubDate>
            <atom:updated>2024-04-26T10:46:22.488Z</atom:updated>
            <content:encoded><![CDATA[<h4>Updates:</h4><p><strong>November 11th, 2023:</strong> I created a gem to help us generate the scaffold for the Rails API and the NextJS app using a single command. Now, we can use dynamic routes. Get more information at <a href="https://github.com/raphox/next_rails_scaffold">https://github.com/raphox/next_rails_scaffold</a>.</p><p>As promised in the <a href="https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-2-308d2f41a767">previous post</a>, it’s time to technically detail the process of creating a <a href="https://guides.rubyonrails.org/">Ruby on Rails</a> application that renders web pages using React components generated by <a href="https://nextjs.org/">Next.js</a>.</p><p>As I shared in the previous post, I made a commit for each step of the process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/0*ubvrETLPn6yZZ19J.png" /><figcaption><a href="https://github.com/raphox/rails-next/commits/main">https://github.com/raphox/rails-next/commits/main</a></figcaption></figure><p>The creation of the project was divided into four stages:</p><ol><li>Create the Ruby on Rails project.</li><li>Create API endpoints for document management.</li><li>Create the Next.js project and configure it so that the HTML and Javascript code generation script sends the files to the Rails project’s public folder.</li><li>Change the Next.js default page to consume API data from the Ruby on Rails project.</li></ol><p>Considering what it takes to integrate Rails with Next.js, let’s now break down each process step.</p><h4>Create the Ruby on Rails project</h4><p>Excellent and detailed documentation on the process of creating a Ruby on Rails application can be found here <a href="https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project">https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project</a>.</p><p>But if you already have all the necessary dependencies, you will basically need to run the following command:</p><pre>rails new my_api --api</pre><p>With just this command, you will have generated all the code to complete the first step.</p><blockquote>The --api option used in the project generation command will discard the entire View layer of the Ruby on Rails project. This is necessary since we are going to use Next.js instead of the View layer.</blockquote><h4>Create API Endpoints for Document Management</h4><p>Now that we have the base code for the Ruby on Rails application let’s make the endpoints available that will be consumed by the React interface.</p><pre>rails g scaffold Document title:string description:string link:string</pre><p>And that’s it. We already have the database structure and endpoints for the following:</p><ul><li>List the documents</li><li>View data for a specific document</li><li>Create a new document</li><li>Update data for a specific document</li><li>Remove a specific document</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1409a4c1df4fa8e28890e6cdfe704ae/href">https://medium.com/media/e1409a4c1df4fa8e28890e6cdfe704ae/href</a></iframe><p>Don’t forget to run the rails db:migrate command to create the database structure.</p><h4>Create the Next.js project</h4><p>To add the Next project, just initialize the project inside the Rails application directory:</p><pre>npx create-next-app@latest</pre><p>Creation options:</p><pre>What is your project named? frontend<br>Would you like to use TypeScript? No / Yes<br>Would you like to use ESLint? No / Yes<br>Would you like to use Tailwind CSS? No / Yes<br>Would you like to use `src/` directory? No / Yes<br>Would you like to use App Router? (recommended) No / Yes<br>Would you like to customize the default import alias? No / Yes</pre><p>When you finish creating the project, you only need to change two files:</p><pre>// frontend/package.json#L7<br>+ &quot;build&quot;: &quot;next build &amp;&amp; next export -o ../public&quot;,<br>// frontend/next.config.js#L4-L6<br>+ images: {<br>+ unoptimized: true,<br>+ },</pre><p>From there you can use the npm run build command to convert your Next application into a <a href="https://en.wikipedia.org/wiki/Single-page_application">SPA</a> within your Rails application’s public public directory.</p><p><strong>Tip:</strong> You have the option to create the Procfile.local file to work together with the <a href="https://github.com/ddollar/foreman">https://github.com/ddollar/foreman</a> gem. That way you don’t have to start the two applications every time you start the project.</p><pre># Procfile.local<br>api: bin/rails server -p 8080<br>frontend: sh -c &#39;cd ./frontend &amp;&amp; npm run dev&#39;</pre><blockquote>For more detailed information on installing, building, and configuring Next.js, visit <a href="https://nextjs.org/docs">https://nextjs.org/docs</a>.</blockquote><h4>Consume API data through SPA</h4><p>To focus on consuming the API and not worry so much about the other features, the generated code example is based on the default page of a Next.js project.</p><p>As you can see in the image below, a list of links to the official Next.js documentation is at the bottom of the page. Let’s change this part of the code to list the links based on the data collected from the API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*j9okAyrL4g8kSMkQ.png" /></figure><p>To consume the API, a hook called useDocuments was created:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74089e3bf6a844bcc7e1d309277295b2/href">https://medium.com/media/74089e3bf6a844bcc7e1d309277295b2/href</a></iframe><p>Using useDocuments inside the main page, we will have access to the API data so that we can print the links:</p><pre>export default function Home() {<br>  const { documents, isLoading } = useDocuments();<br>  // ...<br>        {isLoading ? (<br>          &lt;p&gt;Loading...&lt;/p&gt;<br>        ) : (<br>          documents?.map((document) =&gt; (<br>            &lt;a<br>              key={document.id}<br>              href={document.link}<br>              className=&quot;group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30&quot;<br>              target=&quot;_blank&quot;<br>              rel=&quot;noopener noreferrer&quot;<br>            &gt;<br>              &lt;h2 className={`mb-3 text-2xl font-semibold`}&gt;<br>                {`${document.title} `}<br>                &lt;span className=&quot;inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none&quot;&gt;<br>                  -&amp;gt;<br>                &lt;/span&gt;<br>              &lt;/h2&gt;<br>              &lt;p className={`m-0 max-w-[30ch] text-sm opacity-50`}&gt;<br>                {document.description}<br>              &lt;/p&gt;<br>            &lt;/a&gt;<br>          ))<br>        )}<br>// ...</pre><p>And this is the end of our series of posts.</p><p>I hope that I have contributed so that fewer people have a headache integrating React with Rails and that we can build well-structured projects in Rails, taking advantage of everything that React has provided and provided us in recent years.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a88af492a00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails e Next.js: a combinação perfeita para o desenvolvimento web moderno — Parte Final]]></title>
            <link>https://medium.com/@raphox/rails-e-next-js-a-combina%C3%A7%C3%A3o-perfeita-para-o-desenvolvimento-web-moderno-parte-final-43003e6f0feb?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/43003e6f0feb</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Wed, 02 Aug 2023 12:11:26 GMT</pubDate>
            <atom:updated>2023-08-02T12:11:26.324Z</atom:updated>
            <content:encoded><![CDATA[<h3>Rails e Next.js: a combinação perfeita para o desenvolvimento web moderno — Parte Final</h3><p>Como prometido no <a href="https://medium.com/@raphox/rails-e-next-js-a-combina%C3%A7%C3%A3o-perfeita-para-o-desenvolvimento-web-moderno-parte-2-5681e962adee">post anterior</a>, chegou a hora detalhar tecnicamente o processo de criação de uma aplicação Ruby on Rails que renderize páginas web utilizando componentes React geradas pelo Next.js.</p><p>Como compartilhei no post anterior, eu fiz um commit para cada etapa do processo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*Z0qC3udjZsEG6hLMlAqD_w.png" /><figcaption><a href="https://github.com/raphox/rails-next/commits/main">https://github.com/raphox/rails-next/commits/main</a></figcaption></figure><p>A criação do projeto foi divida em 4 etapas:</p><ol><li>Criar o projeto Ruby on Rails.</li><li>Criar endpoints da API para gerenciamento de documentos.</li><li>Criar o projeto Next.js e configurá-lo para que o script de geração de código HTML e Javascript envie os arquivos para a pasta public do projeto Rails.</li><li>Alterar página padrão do Next.js para consumir dados da API do projeto Ruby on Rails.</li></ol><p>Tendo em vista o que é necessário para se integrar o Rails com o Next.js, vamos agora detalhar cada etapa do processo.</p><h4>Criar o projeto Ruby on Rails</h4><p>Uma excelente e detalha documentação sobre o processo de criação de uma aplicação Ruby on Rails pode ser encontrada aqui <a href="https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project">https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project</a>.</p><p>Mas você que já possui todas as dependências necessárias, basicamente vai precisar executar o seguinte comando:</p><pre>rails new my_api --api</pre><p>Apenas com esse comando, você terá gerado todo o código para concluir a primeira etapa.</p><blockquote>A opção --api utilizada no comando de geração do projeto, irá descartar toda a camada View do projeto Ruby on Rails. Isso é necessário já que vamos utilizar Next.js no lugar da camada View.</blockquote><h4>Criar endpoints da API para gerenciamento de documentos</h4><p>Agora que já temos o código base da aplicação Ruby on Rails, vamos disponibilizar os endpoints que serão consumidos pela interface React.</p><pre>rails g scaffold Document title:string description:string link:string</pre><p>E é só isso. Já temos a estrutura de banco de dados e os endpoints para:</p><ul><li>Listar os documentos</li><li>Visualizar dados de um documento específico</li><li>Criar um novo documento</li><li>Atualizar dados de um documento específico</li><li>Remover um documento específico</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1409a4c1df4fa8e28890e6cdfe704ae/href">https://medium.com/media/e1409a4c1df4fa8e28890e6cdfe704ae/href</a></iframe><p>Não se esqueça de executar o comando rails db:migrate para criar a estrutura do banco de dados.</p><h4>Criar o projeto Next.js</h4><p>Para adicionar o projeto Next, basta você inicializar o projeto dentro do diretório da aplicação Rails:</p><pre>npx create-next-app@latest</pre><p>Opções de criação:</p><pre>What is your project named? frontend<br>Would you like to use TypeScript? No / Yes<br>Would you like to use ESLint? No / Yes<br>Would you like to use Tailwind CSS? No / Yes<br>Would you like to use `src/` directory? No / Yes<br>Would you like to use App Router? (recommended) No / Yes<br>Would you like to customize the default import alias? No / Yes</pre><p>Ao finalizar a criação do projeto, você deve alterar apenas 2 arquivos:</p><pre>// frontend/package.json#L7<br>+    &quot;build&quot;: &quot;next build &amp;&amp; next export -o ../public&quot;,<br><br>// frontend/next.config.js#L4-L6<br>+  images: {<br>+    unoptimized: true,<br>+  },</pre><p>A partir daí você pode utilizar o comando npm run build para converter sua aplicação Next em uma <a href="https://en.wikipedia.org/wiki/Single-page_application">SPA</a> dentro do diretório public de sua aplicação Rails.</p><p><strong>Dica:</strong> Você tem opção de definir o arquivo Procfile.local para trabalhar junto com a gem <a href="https://github.com/ddollar/foreman">https://github.com/ddollar/foreman</a>. Dessa forma você não precisa inicializar as 2 aplicações toda vez que for iniciar o projeto.</p><pre># Procfile.local<br>api: bin/rails server -p 8080<br>frontend: sh -c &#39;cd ./frontend &amp;&amp; npm run dev&#39;</pre><blockquote>Para obter mais informações detalhadas de instalação, criação e configuração do Next.js, acesse <a href="https://nextjs.org/docs">https://nextjs.org/docs</a>.</blockquote><h4>Consumir dados da API através da SPA</h4><p>Para nos focarmos no consumo da API e não nos preocuparmos tanto com as outras funcionalidades, o exemplo de código que foi gerado é baseado na página default de um projeto do Next.js.</p><p>Como pode ser visto na imagem abaixo, na parte inferior da página existe uma lista de links para a documentação oficial do Next.js. Vamos alterar essa parte do código para listar os links com base nos dados coletados da API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-FhbjtOWS3cZsIuYB4PksQ.png" /></figure><p>Para consumir a API foi criado um hook chamado useDocuments :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74089e3bf6a844bcc7e1d309277295b2/href">https://medium.com/media/74089e3bf6a844bcc7e1d309277295b2/href</a></iframe><p>Utilizando o useDocuments dentro da página principal, vamos ter acesso aos dados da API e assim podemos imprimir os links:</p><pre>export default function Home() {<br>  const { documents, isLoading } = useDocuments();<br>  // ...<br>        {isLoading ? (<br>          &lt;p&gt;Loading...&lt;/p&gt;<br>        ) : (<br>          documents?.map((document) =&gt; (<br>            &lt;a<br>              key={document.id}<br>              href={document.link}<br>              className=&quot;group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30&quot;<br>              target=&quot;_blank&quot;<br>              rel=&quot;noopener noreferrer&quot;<br>            &gt;<br>              &lt;h2 className={`mb-3 text-2xl font-semibold`}&gt;<br>                {`${document.title} `}<br>                &lt;span className=&quot;inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none&quot;&gt;<br>                  -&amp;gt;<br>                &lt;/span&gt;<br>              &lt;/h2&gt;<br>              &lt;p className={`m-0 max-w-[30ch] text-sm opacity-50`}&gt;<br>                {document.description}<br>              &lt;/p&gt;<br>            &lt;/a&gt;<br>          ))<br>        )}<br>// ...</pre><p>E este é o fim da nossa serie de posts.</p><p>Espero que eu tenha contribuido para que menos pessoas tenham dor de cabeça para integrar o React com o Rails e que possamos construir projetos bem estruturados em Rails usufruindo de tudo que o React tem nos proporcionado e vem nos proporcionando nos útimos anos.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43003e6f0feb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails and Next.js: the perfect combination for modern web development (Part 2)]]></title>
            <link>https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-2-308d2f41a767?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/308d2f41a767</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Thu, 13 Jul 2023 11:30:09 GMT</pubDate>
            <atom:updated>2023-11-03T11:11:38.015Z</atom:updated>
            <content:encoded><![CDATA[<p>In the <a href="https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-1-d2daf9f8d71d">first part</a> of this post series, I gave an overview in the form of a metaphor about what led me to not use Ruby on Rails as the only development tool.</p><p>Continuing the post series, I’m happy that some readers are curious and ask me what motivated me to follow this development structure. So now, I would like to take the opportunity and answer some of them:</p><blockquote>What does Next.js have to do with React.js?</blockquote><p>Some readers asked me about the use of Next.js and where React comes into play. Therefore, I will list some interesting points:</p><ul><li>Next.js is a Javascript framework that uses React components to render web interfaces.</li><li>You don’t need Rails to develop applications with Next.js and vice versa.</li><li>Next.js is a full-stack framework, but more complete alternatives like <a href="https://nestjs.com/">Nest.js</a> exist. At Nest, you will find a wider range of tools for web development, such as MVC, ORM, Security, Websocket, etc.</li><li>I opted for Next.js as I only need the SPA generation part it provides. After building the application, I am not using Next.js to execute on the server side. What goes into the Ruby on Rails public directory is just Javascript and HTML files that run on the client side.</li></ul><blockquote>Do you need a Javascript framework to develop even the simplest applications?</blockquote><p>The short answer is: no. But we’re here to go into details, right? So let’s delve a little deeper.</p><p>Today, one of the main languages for web development is Javascript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*Ib7t7BTegMsZTc-ZADTtrw.png" /><figcaption><a href="https://survey.stackoverflow.co/2022#most-popular-technologies-language-prof">https://survey.stackoverflow.co/2022#most-popular-technologies-language-prof</a></figcaption></figure><p>It cannot be ignored that if you are looking to create or maintain a web system, you will need to have access to an active community and be able to hire specialized people. In this way, choosing a language like Javascript can be a good strategy.</p><p>Therefore, having a diversity of technologies applied to your project and using technologies that are among the top of the market, you have a good reason to use Ruby on Rails with some other Javascript framework.</p><p>In addition to the diversification of technologies, as I said in my <a href="https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-1-d2daf9f8d71d">previous post</a>, I chose React to have the componentization part in the best way I have found so far. I removed the View layer from Ruby on Rails (ERB, HAML, Slim, Liquid, etc.) and replaced it with Next.js.</p><p>Although it seems like a drastic change, if you choose to use React in your Rails project, this is the best and simplest way possible.</p><p>Another point to consider is that having a development standard for each project within the same ecosystem is impossible. I’m not saying that if a system only has HTML, I must insert Next.js in the Rails application. But if your system needs some dynamic component (a table with AJAX for example), why not create (or import) this component with React and share the same alternative in all your projects? On the contrary, you will have double work to maintain two components that do the same thing.</p><blockquote>Why not use <a href="https://hotwired.dev/">Hotwire</a> instead of React?</blockquote><p>After everything I wrote in my <a href="https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-1-d2daf9f8d71d">first post</a> and in the answer to the previous question, I don’t think there’s much left to add here. But in case you have any doubts, I will list some important points:</p><ul><li>The best way to componentize a Ruby on Rails application is <a href="https://viewcomponent.org/">https://viewcomponent.org/</a>. View Component is an excellent library, but React proved to be more complete in the end.</li><li>Hotwire is very specific to Ruby on Rails, and I’m afraid of limiting my project’s development to something that isn’t known by a wide range of developers.</li><li>Hotwire uses <a href="https://stimulus.hotwired.dev/">https://stimulus.hotwired.dev/</a>. As the Stimulus website says, it is a modest Javascript framework. That is, it will not go much beyond the basics. I would opt for <a href="https://alpinejs.dev/">https://alpinejs.dev/</a> if I was interested in working with managing HTML following a similar approach but with more features.</li></ul><blockquote>Why not use <a href="https://alpinejs.dev/">https://alpinejs.dev/</a> or <a href="https://svelte.dev/?">https://svelte.dev/?</a></blockquote><p>I confess that no one asked me this question, but I myself thought that a framework that, instead of just generating HTML, could also work with the HTML generated by the backend. Alpine and Svelte could be a better alternative than integrating Next.js into the Rails project.</p><p>But in the end, the same points listed as an answer to the question ‘Why not use Hotwire instead of React?’ can also be considered here.</p><blockquote>What about Server-Side Rendering (SSR)?</blockquote><p>This is a point that I still don’t have a concrete answer to, but what I can say so far is that if I need an SSR, I will choose to keep using Next.js, but in a separate project running the application on a Node server. As I described in another post titled ‘<a href="https://medium.com/@raphox/consuming-a-rails-api-with-a-nextjs-client-bf0bb7e75417">Consuming a Rails API with a NextJs client</a>’.</p><blockquote>If I were you, I would switch Ruby on Rails for a complete Javascript alternative.</blockquote><p>In my <a href="https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-1-d2daf9f8d71d">previous post</a>, I believe I described my motivation for not doing this well. But I confess that it took me a few years for the answer to this question to become clear enough and possible to say in a few words:</p><p><strong><em>“I’m not going to give up over ten years of experience with Ruby on Rails just to have access to a better View.”</em></strong></p><p>In no way do I see that Ruby on Rails is inferior to Javascript alternatives and it offers me everything I need to develop a well-structured, organized, secure, stable, and scalable API.</p><p>This means that I will keep my API in a Ruby on Rails application and all the frontend parts will be handled by Next.js.</p><p>In the next and final post of this sequence, I will detail technically how I integrated Rails with Next. You can already take a look at the code here <a href="https://github.com/raphox/rails-next/commits/main">https://github.com/raphox/rails-next/commits/main</a>.</p><p>The last part is here <a href="https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-final-part-a88af492a00">https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-final-part-a88af492a00</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=308d2f41a767" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails e Next.js: a combinação perfeita para o desenvolvimento web moderno — Parte 2]]></title>
            <link>https://medium.com/@raphox/rails-e-next-js-a-combina%C3%A7%C3%A3o-perfeita-para-o-desenvolvimento-web-moderno-parte-2-5681e962adee?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/5681e962adee</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Wed, 12 Jul 2023 11:56:12 GMT</pubDate>
            <atom:updated>2023-07-12T11:59:13.449Z</atom:updated>
            <content:encoded><![CDATA[<h3>Rails e Next.js: a combinação perfeita para o desenvolvimento web moderno — Parte 2</h3><p>Na <a href="https://medium.com/@raphox/rails-e-next-js-a-combina%C3%A7%C3%A3o-perfeita-para-o-desenvolvimento-web-moderno-parte-1-91e6d1655b7d">primeira parte</a> dessa sequência de posts, eu dei um apanhado geral, em formato de metáfora, sobre o que me levou a não utilizar o Ruby on Rails como a única ferramenta de desenvolvimento.</p><p>Continuando a série de posts, fico feliz em ver que alguns leitores estão curiosos e me perguntam sobre o que me motivou a seguir essa estrutura de desenvolvimento. Então agora, gostaria de aproveitar a oportunidade e responder algumas delas:</p><blockquote>O que tem a ver o Next.js com o React.js?</blockquote><p>Alguns leitores me questionaram sobre o uso de Next.js e onde entra o React na história. Por isso, vou listar alguns pontos interessantes:</p><ul><li>Next.js é um framework Javascript que utilizar componentes React para renderizar interfaces web.</li><li>Você não precisa de Rails para desenvolver aplicações com o Next.js e vice-versa.</li><li>Next.js é um framework full-stack, mas existem alternativas mais completas como o <a href="https://nestjs.com/">Nest.js</a>. No Nest você vai encontrar uma gama maior de ferramentas para o desenvolvimento web. Tais como MVC, ORM, Security, Websocket, etc.</li><li>Eu optei pelo Next.js pois eu só preciso da parte de geração de SPA que ele oferece. Em nenhum momento eu utilizo a parte do Next.js que roda do lado do servidor depois de buildar a aplicação. O que vai pro diretório public do Ruby on Rails, são apenas arquivos Javascript e HTML que rodam do lado do cliente.</li></ul><blockquote>Você precisa de um framework Javascript para desenvolver até as aplicações mais simples?</blockquote><p>A resposta curta é: não. Mas estamos aqui para entrar em detalhes, certo? Então vamos nos aprofundar um pouco mais.</p><p>Hoje uma das principais linguagens para desenvolvimento web é o Javascript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*2n9D_RymaJcuZ3zxAqNxOQ.png" /><figcaption><a href="https://survey.stackoverflow.co/2022#most-popular-technologies-language-prof">https://survey.stackoverflow.co/2022#most-popular-technologies-language-prof</a></figcaption></figure><p>Não dá pra ignorar que se você busca criar ou manter um sistema web, você vai precisar ter acesso a uma comunidade ativa e facilidade em contratar pessoas especializadas. Dessa forma, escolher uma linguagem como o Javascript pode ser uma boa estratégia.</p><p>Assim sendo, eu posso dizer que tendo uma diversidade de tecnologias aplicadas ao seu projeto e utilizar tecnologias que estão entre as top do mercado, você tem uma boa razão por utilizar Ruby on Rails com algum outro framework Javascript.</p><p>Além da diversificação de tecnologias, como eu disse no meu <a href="https://medium.com/@raphox/rails-e-next-js-a-combina%C3%A7%C3%A3o-perfeita-para-o-desenvolvimento-web-moderno-parte-1-91e6d1655b7d">post anterior</a>, eu escolhi o React para que eu tivesse a parte de componentização da melhor forma que eu encontrei até o momento. Eu optei por remover a camada de View do Ruby on Rails (ERB, HAML, Slim, Liquid, etc.) e substituí-la pelo <a href="https://nextjs.org/">Next.js</a>.</p><p>Apesar de parecer uma mudança drástica, na verdade se em seu projeto Rails você optou por utilizar React, eu posso te dizer que essa é a forma melhor e mais simples possível.</p><p>Outro ponto a se considerar é que não dá pra ter um padrão de desenvolvimento para cada projeto dentro de um mesmo ecossistema. Não estou falando que se um sistema só tem HTML eu tenha que inserir o Next.js na aplicação Rails. Mas se seu sistema possui a necessidade de algum componente dinâmico (uma tabela com AJAX por exemplo), porque não criar (ou importar) esse component com React e compartilhar a mesma alternativa em todos seus projetos? Ao contrário disso, você terá trabalho dobrado para manter dois componentes que fazem a mesma coisa.</p><blockquote>Porque não utilizar <a href="https://hotwired.dev/">Hotwire</a> ao invés de React?</blockquote><p>Depois de tudo que escrevi no meu <a href="https://medium.com/@raphox/rails-e-next-js-a-combina%C3%A7%C3%A3o-perfeita-para-o-desenvolvimento-web-moderno-parte-1-91e6d1655b7d">primeiro post</a> e na resposta da perguntar anterior, eu acho que não resta muito a se adicionar aqui. Mas caso tenha restado alguma dúvida, vou listar alguns pontos importantes:</p><ul><li>A melhor forma de se componentizar uma aplicação Ruby on Rails é o <a href="https://viewcomponent.org/">https://viewcomponent.org/</a>. View Component é uma excelente biblioteca, mas no fim o React se mostrou mais completo.</li><li>Hotwire é algo muito específico do Ruby on Rails e tenho receio de limitar o desenvolvimento do meu projeto com algo que não seja conhecido por uma grande gama de desenvolvedores.</li><li>Hotwire utiliza <a href="https://stimulus.hotwired.dev/">https://stimulus.hotwired.dev/</a>. Como o próprio site do Stimulus diz, ele é um framework Javascript modesto, ou seja, ele não vai entrar muito além do básico. Eu optaria pelo <a href="https://alpinejs.dev/">https://alpinejs.dev/</a> se eu tivesse interesse em trabalhar gerenciando HTML seguindo uma abordagem parecida mas com mais recursos.</li></ul><blockquote>Porque não utilizar <a href="https://alpinejs.dev/">https://alpinejs.dev/</a> ou <a href="https://svelte.dev/">https://svelte.dev/</a>?</blockquote><p>Confesso que ninguém me fez essa pergunta, mas eu mesmo cheguei a pensar que algum framework que, ao invés de apenas gerar HTML, ele também conseguisse trabalhar com o HTML gerado pelo backend. Alpine e Svelte poderiam ser uma alternativa simples e melhor que integrar Next.js ao projeto Rails.</p><p>Mas no fim, os mesmo pontos listados como resposta da pergunta ‘<em>Porque não utilizar Hotwire ao invés de React?</em>’, também podem ser considerados aqui.</p><blockquote>Como fica o Server-Side Rendering (SSR)?</blockquote><p>Esse é um ponto que eu ainda não tenho uma resposta concreta, mas o que eu posso dizer até o momento é que caso eu precise de um SSR, eu optaria por manter o uso do Next.js, mas em um projeto separado executando a aplicação em um servidor Node. Tal como eu descrevi em um outro post com o título ‘<a href="https://medium.com/@raphox/consuming-a-rails-api-with-a-nextjs-client-bf0bb7e75417">Consuming a Rails API with a NextJs client</a>’.</p><blockquote>Se eu fosse você trocaria o Ruby on Rails por uma alternativa completa em Javascript.</blockquote><p>No meu <a href="https://medium.com/@raphox/rails-e-next-js-a-combina%C3%A7%C3%A3o-perfeita-para-o-desenvolvimento-web-moderno-parte-1-91e6d1655b7d">post anterior</a> eu acredito ter descrito bem minha motivação de não fazer isso. Mas eu confesso que eu demorei alguns anos para que a resposta para essa pergunta ficasse clara o suficiente e possível de se dizer em poucas palavras:</p><p><strong><em>“Eu não vou trocar mais de 10 anos de experiência com Ruby on Rails apenas para ter acesso a uma View melhor.”</em></strong></p><p>De nenhuma forma eu vejo que o Ruby on Rails é inferior perante as alternativas Javascript e eu tenho a certeza que ele me oferece tudo que eu preciso para desenvolver uma API bem estruturada, organizada, segura, estável e escalável.</p><p>Isso quer dizer que eu vou manter minha API em uma aplicação Ruby on Rails e toda a parte do frontend vai ficar por conta do Next.js.</p><p>No próximo e último post dessa sequência, eu vou detalhar tecnicamente como eu integrei o Rails com Next. Você já pode ir dando uma olhada no código aqui <a href="https://github.com/raphox/rails-next/commits/main">https://github.com/raphox/rails-next/commits/main</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5681e962adee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails and Next.js: the perfect combination for modern web development (Part 1)]]></title>
            <link>https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-1-d2daf9f8d71d?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2daf9f8d71d</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 18:40:05 GMT</pubDate>
            <atom:updated>2023-11-03T11:10:52.565Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m not giving up my knowledge of over ten years in Ruby on Rails and all the benefits it offers me, just for a more appealing View.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*maSPMRLAxudlsu4gwyptUQ.jpeg" /></figure><p>Next.js, among other great Javascript frameworks, has evolved a lot over the last few months. Like any good framework, the community or private companies play a key role in this evolution.</p><p>As a full-stack developer using Ruby on Rails for over ten years, I’ve been keeping up to date and watching for Javascript technologies constantly appearing on the market. In my position, Javascript’s grass has always looked greener to me than Ruby’s. I think more for marketing reasons than efficiency. But when I decided to change yards, I came across some holes and stones that were not visible from afar. Not to mention that I always missed my beautiful, comfortable chair that awaited me on the other side.</p><p>The main reason I found the grass greener in Javascript was the existing componentization in frameworks like <a href="https://react.dev/">React</a> and <a href="https://vuejs.org/">Vue</a>. There’s even a great Ruby library with this same framework designed to integrate with Ruby on Rails, which you can find at <a href="https://viewcomponent.org/">https://viewcomponent.org/.</a> While using the View Component, I can only see myself trying to find a way for things to work as they did in React. But in the end, I never came up with something as good as a React component.</p><p>For those who still can’t enjoy everything React has to offer and still haven’t had the opportunity to experience what it’s like to use componentization with React, I recommend taking a look at this fantastic component library <a href="https://www.radix-ui.com/">https://www.radix-ui.com</a> /. It’s really worth taking a look at the usage examples and even the project’s source code to see how to create very well-structured components.</p><p>As I understand it, the React community could count on several specialist members who had the same goal of getting where they got to. While the Ruby developers did their best to try and keep up, they couldn’t rely on the full apparatus that the Javascript community had access to.</p><p>After a few years of going back and forth, I decided it was time to remove the fence and enjoy both yards simultaneously.</p><p>I understood that there are many letters in the <strong>MVC</strong> (<strong>M</strong>odel, <strong>V</strong>iew, and <strong>C</strong>ontroller) of Ruby on Rails and that it wouldn’t hurt to change the <strong>V</strong> for <strong>R</strong> and make my <strong>M</strong>odel, <strong>R</strong>eact and <strong>C</strong>ontroller.</p><p>So that was it. Sitting in my pretty chair, I can now see my two backyards as one and can walk freely between them. There are still holes and rocks on both sides, but now I can dig a little dirt from one side to plug the hole on the other.</p><p>The second part is here <a href="https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-2-308d2f41a767">https://medium.com/@raphox/rails-and-next-js-the-perfect-combination-for-modern-web-development-part-2-308d2f41a767</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2daf9f8d71d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails e Next.js: a combinação perfeita para o desenvolvimento web moderno — Parte 1]]></title>
            <link>https://medium.com/@raphox/rails-e-next-js-a-combina%C3%A7%C3%A3o-perfeita-para-o-desenvolvimento-web-moderno-parte-1-91e6d1655b7d?source=rss-754d3f9e2e50------2</link>
            <guid isPermaLink="false">https://medium.com/p/91e6d1655b7d</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Raphael Almeida Araújo]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 14:45:27 GMT</pubDate>
            <atom:updated>2023-07-10T14:45:27.455Z</atom:updated>
            <content:encoded><![CDATA[<h3>Rails e Next.js: a combinação perfeita para o desenvolvimento web moderno — Parte 1</h3><h4>Não vou abrir mão dos meus mais de 10 anos de experiência com Ruby on Rails e tudo que ele me oferece, apenas para ter uma View melhor.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*maSPMRLAxudlsu4gwyptUQ.jpeg" /></figure><p>O <a href="https://nextjs.org/">Next.js</a>, dentre outros ótimos frameworks Javascript, vem evoluindo muito durante os últimos meses. Assim como qualquer outro bom framework, a comunidade ou até empresas privadas, possuem um papel fundamental nessa evolução.</p><p>Como desenvolvedor full-stack utilizando Ruby on Rails durante mais de 10 anos, tenho me mantido atualizado e fico sempre com olhar atento nas tecnologias Javascript que sempre aparecem no mercado. Na minha posição, a grama do Javascript sempre me pareceu mais verde que a do Ruby. Acho que mais por razão do marketing do que pela eficiência. Mas quando resolvia mudar de quintal, eu começavam a me deparar com alguns buracos e pedras que de longe não eram visíveis. Sem contar que eu sempre sentia saudades da minha cadeira bonita e confortável que sempre me esperava do outro lado.</p><p>O principal motivo que me levou a achar a grama do Javascript mais verde, era a parte de componentização existente em frameworks como o <a href="https://react.dev/">React</a> e <a href="https://vuejs.org/">Vue</a>. Existe até uma ótima biblioteca em Ruby com essa mesma estrutura desenvolvida para se integrar com o Ruby on Rails, a qual você pode encontrar em <a href="https://viewcomponent.org/">https://viewcomponent.org/</a>. Durante o uso do <em>View Component</em> eu só consiga me ver tentando encontrar uma forma das coisas funcionarem como funcionavam no React. Mas no final, nunca eu conseguia chegar em algo tão bom como um componente desenvolvido utilizando React.</p><p>Pra quem ainda não pode usufruir de tudo o que o React tem a oferecer e ainda não teve oportunidade de experienciar como é utilizar componentização com React, eu indico dar uma olhada nessa fantástica biblioteca de componentes <a href="https://www.radix-ui.com/">https://www.radix-ui.com/</a>. Vale muito dar uma olhada nos exemplos de uso e até no código fonte do projeto para ver como criar componentes muito bem estruturados.</p><p>Ao meu entender, a comunidade React pôde contar com vários membros especialista que tinham o mesmo objetivo de chegar onde chegaram. Enquanto os desenvolvedores Ruby deram seu melhor pra tentar acompanhar, mas não puderam contar com todo o aparato do qual a comunidade Javascript teve acesso.</p><p>Depois de alguns anos indo e vindo de um lado para o outro, resolvi que era hora de remover a cerca e usufruir dos dois quintais ao mesmo tempo.</p><p>Entendi que há muitas letras no <strong>MVC</strong> (<strong>M</strong>odel, <strong>V</strong>iew and <strong>C</strong>ontroller) do Ruby on Rails e que não faria mal trocar o <strong>V</strong> por <strong>R</strong> e fazer o meu <strong>M</strong>odel, <strong>R</strong>eact and <strong>C</strong>ontroller.</p><p>Então foi isso. Sentado da minha cadeira bonita, agora eu consigo ver os meus dois quintais como um só e posso andar livremente entre eles. Ainda há buracos e pedras em ambos os lados, mas agora eu consigo tirar um pouco de terra de um lado pra tampar o buraco do outro.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91e6d1655b7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>