August 20, 2010
For the past few months, I've been writing a lot of code using Yesod. The problem is, this has all been on a proprietary project. Not only can I not open source the code for the site, I can't even show you the site. (I'm sure a little detective work would be enough to discover it, but even so you can't get past the homepage without an account.)
So this presents a little bit of a predicament for learning Yesod. There's a documentation site that has some screencasts, and I've started to work on writing a more detailed book, but sometimes you just need to see the code for a real live site to get a feel for things.
So I started putting together a site called Orange Roster, both to scratch a personal itch and to get out a real-life Yesod example project. The source code is available on Github. I know that I put the Facebook secret key in the repo; if anyone decides to abuse my Facebook application test account... well, you suck ;).
This project demonstrates the most recent "best practices" for laying out a large Yesod project, splitting up the code into multiple files, separating the Hamlet templates into separate files, and using Cassius and Julius. It depends on Yesod 0.5, which hasn't been released quite yet. This was in fact done on purpose: I'm using this project to smoke out the last few changes to be made to Yesod before releasing.
You don't really need to know what the point of the site is to benefit from the source code, but I'll give a brief description. I'm always irked that I need to log into Facebook to get someone's phone number. I actually keep a spreadsheet with a lot of people's phone numbers, but numbers change, and you don't always remember to put everyone's number in your address book/spreadsheet. All together, here are the annoyances:
- I hate logging into Facebook. It's a privacy trap, changes its structure often enough that I always have trouble finding the information I want, and just in general isn't geared for this usage.
- It's annoying having to keep information in two places: if I want to store people's phone numbers, I put it in my spreadsheet. If I want someone else's contact information, I look it up on Facebook.
- And I really don't like spreadsheets that much anyway. That's probably a bit of post-traumatic stress from working in the insurance industry, but when I see those rows and columns staring at me I start getting images of horrible Visual Basic code manipulating cell formats.
So Orange Roster is a very simplistic website: you log in, create a profile, share your profile with whomever you want, and add entries to an address book. You share your profile via email addresses. If the user is in the system already, then you immediately show up in their "sharing" tab. Otherwise, they get an email invitation. And here's another great feature: sharing is unidirectional. I can share with you and you don't have to share with me.
The site is not done, and I'm not giving any guarantees on holding onto your data yet, but you can play around with it, experiment, and give me feedback. Here are some of the features I haven't yet implemented:
- Edit/delete profile data after you've entered it.
- Connecting a user to an address book entry.
- Importing your list of friends from Facebook. This would obviously be an optional feature, I have no intention of invading privacy here.
As stated, Yesod 0.5 is almost ready for release. I'm playing around with a few last-minute changes, such as persistent using the newly released enumerator package.
PS: My appologies if the site runs a bit slowly, I'm running it on an (apparently) very low-end VPS. I'll probably be switching providers before bumping this site up to beta status.