Simple showcase project to allow quickly start with development process of modern web based application.
Live demo is available on http://bootstrap.softwaremill.com.
Project is divided in few separated modules but basically we have UI which is base on AngularJS and REST backend based on Scalatra. Backend can be interchanged as there is no dependency between frontend and backend - spray.io was also an option.
Development in progress
- Changing profile data - login and e-mail
- Changing password
- Possibility to reset forgotten password
Why not :-)
Basically it's the hottest JavaScirpt framework right now, developed and supported by Google. It offers complete solution to build dynamic and modern HTML5 based web applications. And at last from version 1.x is quite stable :-)
It's also worth to notice that there are plans to natively support DOM templating with the next generation of web browsers
- thus it can be huge advantage of the AngularJS over other frameworks.
It's quite simple and easy to jump into Scalatra for an ordinary Java developer whom used Servlets previously. The syntax of the flow directives is straightforward and it was easy to integrate support for JSON into it. And it's written in Scala from scratch which seamlessly integrates with other Scala based libraries.
It is a convenient queueing solution that allows to decuple message storing and reading. And it resides in the cloud, what could be more cool than that? Of course we could use simple queue stored in the MongoDB, but this project is not supposed to be boring :)
The answer can be hard. It is easy to start using sbt, but when things get hard, it's very difficult to find good examples or supporting documents. But at the end it's a dedicated tool for Scala platform, so why not to try it :-)
To run application, simply clone the source code, enter the directory and type ./run.sh or run.bat depends on your OS, navigate your web browser to http://localhost:8080/ and start using the application. By default application is using in-memory queue and dummy e-mail sender.
Because some tests are using MongoDB you should have it installed on your machine. Additionally you should let SBT know where MongoDB files are located. To do that please add one line to your ~/.sbt/local.sbt:
SettingKey[File]("mongo-directory") := file("/Users/your_user/apps/mongodb")
with proper path to your MongoDB installation directory.
After that SBT will start MongoDB instance before executing each test class that exetends SpeficationWithMongo trait.
If you want to start develop new features, you must have sbt version 0.12.1 installed. Enter the same directory as above and type sbt to start the sbt console. Few plugins are already integrated with t
- IDE configuration: we are using the best IDE right now - IntelliJ IDEA - to be able open project with it you must generate project files, you can do that with: gen-idea
- web server: right now Jetty is integrated with the project, you can start it from the sbt console with: container:start
There are two implementations of storage - in-memory and mongo - you must install MongoDB and start it before starting the application (when started with run.sh/run.bat the in-memory storage is used)
- compile - compile the whole project
- test - run all the tests
- project <sub-project-name> - switch context to given sub-project, then all the commands will be execute only for that sub-project, thus can be also achieved with: <sub-project-name>/test
- container:start - starts the embedded Jetty container
- container:reload / - reloads application at context /
- ~;container:start; container:reload / - runs container and waits for source code changes to automatically compile changed file and to reload it
- scalariform-format - execute Scalariform code formatter. More about it below in 'Keep code in shape' section
- jslint - execute JSLint JavaScript code quality checker. It prints results to the console and writes them in /target/jslint/results.xml
To keep code in shape we are using Scalariform code formatter for Scala along with sbt plugin Sbt-Scalariform. We have intentionally disabled auto code-formatting during compile or test execution so to run formatter please use sbt scalariform-format command. It checks code against various styling rules and applies all neccessary fixes.
For JavaScript we are using SBT JSLint Plugin serving the same purpose. JSLint is executed during test phase.
All configuration should be stored in application.conf file. Please check application.conf.template to see what values are needed.
- To have Amazon SQS running you have to provide AWSAccessKeyId, SecretAccessKey and name of existing queue defined on your AWS account.
- To have e-mail sender working please provide smtp details (host, port, password, username). For smtp service working on localhost please comment smtpUsername key so EmailSender will know that he should use not secured smtp service.
application.conf file should be placed next to application.conf.template
Project is licensed under Apache 2.0 License which means you can freely use any part of the project.