Giter Club home page Giter Club logo

hack4impact-boston-university_v5ju's Introduction

Hack4Impact Boston University's Chapter Website ๐Ÿš€

Deploy to Netlify

Our tech stack

This template is built for generating a static, super-efficient website that you can easily update overtime. For this, NextJS + Contentful formed the perfect dream team.

NextJS โš™๏ธ

NextJS is a great match for static sites, especially if you're already familiar with React. The main benefit is flexibility: you can build most of your site to static, super-efficient HTML. Then, as your site expands, you can explore server rendering and caching with almost zero extra setup. This opens to door for admin portals, nonprofit dashboards, and more!

Contentful ๐Ÿ“

The Contentful CMS is where all your text content and media (images and videos) are hosted. Above all, this services eliminates the need to "ask the developer" whenever you want to add content to the site.

Have a new nonprofit project page to create? Need to update applications for the next recruitment cycle? Just edit some Google-Doc-style text boxes and hit "publish." If you're hosting your site on Netlify, you can trigger your site to redeploy whenever new content is published!

Set up Contentful

If you're unfamiliar with connecting NextJS and Contentful using GraphQL, read this article before proceeding ๐Ÿ‘‡

NextJS, Contentful CMS, GraphQL, oh my!

Set your environment variables

To use Contentful in your project, you'll need to set some keys to talk to our Hack4Impact space.

Note that we recommend using our existing Hack4Impact Contentful space. Please contact us over slack or at [email protected] for these credentials.

Once you have them, create a .env file in the base folder of this repo, and paste these contents:

# Token to log into our Contentful organization
NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN=
# ID for the Hack4Impact website space
NEXT_PUBLIC_CONTENTFUL_SPACE_ID=
# ID for your Website Layout model
LAYOUT_ENTRY_ID=

Create a new Website Layout entry

If you use our Hack4Impact space, you'll have a content model called Website Layout that you can access. This model outlines all major pieces of your site, from your university logo to your nonprofit projects to your recruitment cycle information.

To create a new entry for your chapter's website:

  1. Head to the Content tab and search for the "Example Template" to see how your end product might look contentful search for Example Template, filtered by Website Layout
  2. Back out and create a new Website Layout entry from the Add Entry button. You can also Duplicate our template for a nice starting point, but be warned! All referenced entries in this template (values, projects, etc) are not duplicated. You'll need to detach these from your duplicated template, or you'll accidentally modify our example ๐Ÿ˜ฌ
  3. Fill out the contents as you wish. Feel free to omit non-required values where necessary, since this repo should be smart enough to handle optional content!
  4. Copy your layout's Entry ID into your environment variables (.env) as the LAYOUT_ENTRY_ID. To find this, just head to the Info tab on your entry and copy the ID from there.

Building the site

Make sure you have node installed first. Then, pop open a terminal and run these commands in the project directory:

npm i
npm run dev

This will spin up a local server for you to preview your site. Note that the build will fail if you haven't set your .env file! Head back to the "Set up Contentful" step for this.

๐Ÿ’ก And no, don't use yarn here. That will create a second "lock" file that you won't want to push to the repository.

Set up your editor

VS Code is our editor of choice at Hack4Impact. This is why our repo comes with a .vscode directory, which will auto-configure some settings for this project (like auto-formatting code on save) and recommend some important extensions (eslint and prettier).

If you use an editor other than VS Code, don't fret! Just make sure you are using a prettier equivalent to format code while you work. All else fails, you can manually run these commands to fix formatting issues:

  • npm run format - to fix any styling issues in your code (indentation and spacing, namely)
  • npm run lint:fix - to fix any syntax concerns (like accessibility problems, bad HTML attributes, etc.)

Building for production

If you use our template as-is, you'll probably want to "export" your site to a static set of HTML files. For this, just run the command:

npm run export

This will create a production-ready build of your site in the /out directory. This is the command you'll want to run for deployment as well.

Deployment

Run npm run build && npm run export then push or merge your code into branch prod.

or

Run npm run build && npm run export and firebase deploy.

hack4impact-boston-university_v5ju's People

Contributors

tko22 avatar anniegw2 avatar rgychiu avatar choiboy98 avatar buicicchen avatar suewee avatar arpanlaha avatar angadgarg25 avatar vrunjeti avatar maya-b-coding avatar abhisuri97 avatar alvin-wu avatar bendemers avatar polarpi avatar trellixvulnteam avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.