Code Monkey home page Code Monkey logo

snowtricks's Introduction

Maintainability Quality Gate Status

SnowTricks

Project 6 - Snowboard site built with Symfony Framework.

Requirements

Mandatory :

  • PHP >= 7.4
  • Symfony CLI
  • npm or yarn

Optional :

  • Make to use the Makefile and custom commands
  • Docker and Docker-compose for MySQL database and PhpMyAdmin containers
  • MailDev to catch emails (registration and lost password), or another mailcatcher

Unit Tests :

  • PHPUnit

Installation

  1. To get this project on your local machine, simply clone this repository :

    git clone [email protected]:OlivierFL/snowtricks.git
  2. Install the dependencies :

  • composer install

  • npm install

    or if Make is installed on your machine :

  • make deps-install will run the above commands automatically.

  1. Environment configuration :

    To configure local dev environment, create a .env.local file at the root of the project.

    To configure database connection, override the DATABASE_URL env variable with your database credentials and database name, for example :

    DATABASE_URL="mysql://root:[email protected]:3306/snowtricks?serverVersion=5.7"

    If you're using the MySQL Docker container, the config is :

    DATABASE_URL="mysql://root:[email protected]:3306/snowtricks"

    To enable sending registration and lost password emails, add in the .env.local file the MAILER_DSN env variable, for example with MailDev :

    MAILER_DSN="smtp://localhost:1025"

    In the .env file, 2 variables are available, to configure the default number of tricks displayed on homepage, and the number of comments displayed on each trick detail page :

    TRICKS_LIST_LIMIT=8
    COMMENTS_LIST_LIMIT=4
  2. After configuring the database connection, run bin/console doctrine:database:create to create the database.

  3. Import the example data set available in the dump directory in the database. If you're using Docker, PhpMyAdmin is available on localhost:8080 (user : root, password : admin).

  4. Build the assets for development with npm run dev, or npm run watch to recompile every time a file is changed (CSS or Javascript). To build for production, run npm run build. The documentation for WebpackEncore is available on Symfony documentation page.

  5. Start the Symfony server with symfony server:start.

The homepage is available on : localhost:8000.

Usage

List of useful commands to use the project :

  • symfony server:start to start the Symfony server
  • symfony server:stop to stop the Symfony server
  • npm run dev to build the assets for dev environment
  • npm run watch to re-build the assets every time a CSS or Javascript file is modified
  • npm run build to build the assets for production
  • maildev --hide-extensions STARTTLS to start MailDev, if installed, available on localhost:1080

Commands to use with Docker and Make (commands are available in Makefile at the root of the project) :

  • make up to start Docker stack (MySQL and PhpMyAdmin) and Symfony server
  • make up-dev to start Docker stack (MySQL and PhpMyAdmin) and Symfony server and build assets for dev environment
  • make up-watch to start Docker stack (MySQL and PhpMyAdmin) and Symfony server, build assets for dev environment and watch files changes
  • make mail to start MailDev, available on localhost:1080
  • make down to stop Docker stack (MySQL and PhpMyAdmin) and Symfony server

Sample data

In order to have a fully functional application, the SQL file contains :

  • 2 users with different states :

    • an admin user with [email protected] email, admin username and Admin1234 password. This user has role admin and can create, edit and delete any snowboard tricks, post comments and moderate comments in admin dashboard.

    • a simple user with [email protected] email, test username and Test1234! password. This user can create and edit any tricks, delete his own tricks, post comments.

  • A default list of Tricks with some example media and comments.

Third party libraries

Packages and bundles used in this project :

Docker (optional)

This project uses Docker for MySQL database and PhpMyAdmin.

The stack is composed of 2 containers :

  • mysql
  • phpMyAdmin

The configuration is available in the docker-compose.yaml.

Catching emails (optional)

Instead of sending emails to a real email address, a mailcatcher can be used. For this project, I used MailDev, installed locally, to catch emails.

The Symfony MAILER_DSN env variable configuration for MailDev is available in the installation part.

Tests

PhpUnit is used to run the tests.

In a terminal, at the root of the project, run vendor/bin/phpunit.

Code quality

Links to code quality tools used for this project:

Codeclimate : https://codeclimate.com/github/OlivierFL/snowtricks

SonarCloud : https://sonarcloud.io/dashboard?id=OlivierFL_snowtricks

snowtricks's People

Contributors

olivierfl avatar dependabot[bot] avatar

Watchers

 avatar

snowtricks's Issues

Add readme

Add readme file and up to date database dump file

Create snowboard trick update page

  • Create Controller for trick update page
  • Add Routing for trick update page
  • Create form for trick update
  • Create Twig templates with design
  • Add messages for successful update and errors

Create snowboard trick creation page

  • Create Controller for new trick creation page
  • Add Routing for new trick creation page
  • Create form for new trick creation
  • Create Twig templates with design
  • Add messages for successful creation and errors

Create comments system

  • Create Controller for comments
  • Add Routing for comments
  • Create form for posting a comment
  • Create Twig templates with design

Serializer timeout

Fix serializer timeout when using AJAX request to load more Tricks on homepage, and Comments on Trick detail page

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.